Skip to content

Commit

Permalink
Put caching statements where the values are created.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelherger committed Sep 7, 2024
1 parent a1af668 commit a32a617
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions Slim/Control/Queries.pm
Original file line number Diff line number Diff line change
Expand Up @@ -698,10 +698,10 @@ sub albumsQuery {
$total_sth->execute( @{$p} );
($count) = $total_sth->fetchrow_array();
$total_sth->finish;
}

if ( !$stillScanning ) {
$cache->{$cacheKey} = $count;
if ( !$stillScanning ) {
$cache->{$cacheKey} = $count;
}
}

if ($stillScanning) {
Expand Down Expand Up @@ -1223,10 +1223,10 @@ sub artistsQuery {
$total_sth->execute( @{$p} );
($count) = $total_sth->fetchrow_array();
$total_sth->finish;
}

if ( !$stillScanning ) {
$cache->{$cacheKey} = $count;
if ( !$stillScanning ) {
$cache->{$cacheKey} = $count;
}
}

my $totalCount = $count || 0;
Expand Down Expand Up @@ -1821,10 +1821,10 @@ sub genresQuery {
$total_sth->execute( @{$p} );
($count) = $total_sth->fetchrow_array();
$total_sth->finish;
}

if ( !$stillScanning ) {
$cache->{$cacheKey} = $count;
if ( !$stillScanning ) {
$cache->{$cacheKey} = $count;
}
}

# now build the result
Expand Down Expand Up @@ -4757,9 +4757,10 @@ sub worksQuery {
$total_sth->execute( @{$p} );
($composerCount) = $total_sth->fetchrow_array();
$total_sth->finish;
}
if ( !$stillScanning ) {
$cache->{$cacheKey} = $composerCount;

if ( !$stillScanning ) {
$cache->{$cacheKey} = $composerCount;
}
}


Expand All @@ -4778,9 +4779,10 @@ sub worksQuery {
$total_sth->execute( @{$p} );
($count) = $total_sth->fetchrow_array();
$total_sth->finish;
}
if ( !$stillScanning ) {
$cache->{$cacheKey} = $count;

if ( !$stillScanning ) {
$cache->{$cacheKey} = $count;
}
}

my $order_by = "ORDER BY composer.namesort, works.titlesort";
Expand Down

0 comments on commit a32a617

Please sign in to comment.