Bug 9967 - include $branch_limit in the cache key

Make the caching more correct. Also removes a warn that got left behind.

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Robin Sheat 2014-06-03 10:41:46 +12:00 committed by Tomas Cohen Arazi
parent 1878cb0bdf
commit 56844b81d7

View file

@ -1140,16 +1140,16 @@ sub GetAuthorisedValues {
# what it's for. # what it's for.
# Is this cached already? # Is this cached already?
$opac = $opac ? 1 : 0; # normalise to be safe $opac = $opac ? 1 : 0; # normalise to be safe
my $selected_key = defined($selected) ? $selected : '';
my $cache_key = "AuthorisedValues-$category-$selected_key-$opac";
my $cache = Koha::Cache->get_instance();
my $result = $cache->get_from_cache($cache_key);
warn "fetched $result from cache";
return $result if $result;
my $branch_limit = my $branch_limit =
C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
my $selected_key = defined($selected) ? $selected : '';
my $cache_key =
"AuthorisedValues-$category-$selected_key-$opac-$branch_limit";
my $cache = Koha::Cache->get_instance();
my $result = $cache->get_from_cache($cache_key);
return $result if $result;
my @results; my @results;
my $dbh = C4::Context->dbh; my $dbh = C4::Context->dbh;
my $query = qq{ my $query = qq{