use File::Spec;
use Time::HiRes qw/time sleep/;
use OpenSRF::Utils::Cache;
+use OpenSRF::Utils::JSON;
use OpenSRF::Utils::Logger qw/$logger/;
use OpenILS::Utils::CStoreEditor qw/:funcs/;
use OpenILS::Utils::Fieldmapper;
aou_tree => {en_us => undef},
aouct_tree => {},
eg_cache_hash => undef,
- authority_fields => {en_us => {}}
+ authority_fields => {en_us => {}},
+ copy_location_groups => {en_us => {}}
);
sub init_ro_object_cache {
push(@ctx_orgs, $ctx->{physical_loc}) if $ctx->{physical_loc};
push(@ctx_orgs, $ctx->{user}->home_ou) if $ctx->{user};
+ @ctx_orgs = sort(keys %{{ map {$_ => 1} @ctx_orgs}}); # sort/uniq
+ my $cache_key = OpenSRF::Utils::JSON->perl2JSON(\@ctx_orgs);
+
+ return $cache{copy_location_groups}{$ctx->{locale}}{$cache_key}
+ if $cache{copy_location_groups}{$ctx->{locale}}{$cache_key};
+
my $grps = $self->editor->search_asset_copy_location_group([
{
opac_visible => 't',
my %buckets;
push(@{$buckets{$_->owner}}, $_) for @$grps;
- $ctx->{copy_location_groups} = \%buckets;
+
+ $ctx->{copy_location_groups} =
+ $cache{copy_location_groups}{$ctx->{locale}}{$cache_key} =
+ \%buckets;
}
sub set_file_download_headers {