From f75322070182ec67076137b80173523fd3215173 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 22 Jun 2016 16:02:08 +0100 Subject: [PATCH] Bug 17189: Add the ability to define several memcached namespaces - replace existing occurrences s/Koha::Cache->get_instance/Koha::Caches->get_instance Signed-off-by: Jacek Ablewicz Signed-off-by: Tomas Cohen Arazi https://bugs.koha-community.org/show_bug.cgi?id=11921 Signed-off-by: Kyle M Hall --- C4/Biblio.pm | 4 ++-- C4/Calendar.pm | 14 +++++++------- C4/Context.pm | 2 +- C4/External/OverDrive.pm | 2 +- C4/Items.pm | 2 +- C4/Koha.pm | 2 +- C4/Utils/DataTables/ColumnsSettings.pm | 2 +- Koha/Calendar.pm | 4 ++-- Koha/Template/Plugin/Cache.pm | 2 +- admin/biblio_framework.pl | 2 +- admin/koha2marclinks.pl | 2 +- admin/marc_subfields_structure.pl | 2 +- admin/marctagstructure.pl | 2 +- opac/svc/report | 2 +- svc/report | 2 +- t/Calendar.t | 2 +- t/db_dependent/Filter_MARC_ViewPolicy.t | 2 +- t/db_dependent/Items.t | 4 ++-- tools/newHolidays.pl | 2 +- 19 files changed, 28 insertions(+), 28 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 3a34d79524..8865daacd6 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1122,7 +1122,7 @@ sub GetMarcStructure { $frameworkcode = "" unless $frameworkcode; $forlibrarian = $forlibrarian ? 1 : 0; - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); my $cache_key = "MarcStructure-$forlibrarian-$frameworkcode"; my $cached = $cache->get_from_cache($cache_key); return $cached if $cached; @@ -1230,7 +1230,7 @@ sub GetMarcSubfieldStructure { $frameworkcode //= ''; - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); my $cache_key = "MarcSubfieldStructure-$frameworkcode"; my $cached = $cache->get_from_cache($cache_key); return $cached if $cached; diff --git a/C4/Calendar.pm b/C4/Calendar.pm index 82dc35a3a0..18a23ababb 100644 --- a/C4/Calendar.pm +++ b/C4/Calendar.pm @@ -276,7 +276,7 @@ sub insert_single_holiday { # changed the 'single_holidays' table, lets force/reset its cache - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; $cache->clear_from_cache( 'exception_holidays') ; @@ -321,7 +321,7 @@ sub insert_exception_holiday { $self->{'exception_holidays'}->{"$options{year}/$options{month}/$options{day}"}{description} = $options{description}; # changed the 'single_holidays' table, lets force/reset its cache - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; $cache->clear_from_cache( 'exception_holidays') ; @@ -422,7 +422,7 @@ UPDATE special_holidays SET title = ?, description = ? $self->{'single_holidays'}->{"$options{year}/$options{month}/$options{day}"}{description} = $options{description}; # changed the 'single_holidays' table, lets force/reset its cache - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; $cache->clear_from_cache( 'exception_holidays') ; @@ -465,7 +465,7 @@ UPDATE special_holidays SET title = ?, description = ? $self->{'exception_holidays'}->{"$options{year}/$options{month}/$options{day}"}{description} = $options{description}; # changed the 'single_holidays' table, lets force/reset its cache - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; $cache->clear_from_cache( 'exception_holidays') ; @@ -546,7 +546,7 @@ sub delete_holiday { } # changed the 'single_holidays' table, lets force/reset its cache - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; $cache->clear_from_cache( 'exception_holidays') ; @@ -577,7 +577,7 @@ sub delete_holiday_range { $sth->execute($self->{branchcode}, $options{day}, $options{month}, $options{year}); # changed the 'single_holidays' table, lets force/reset its cache - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; $cache->clear_from_cache( 'exception_holidays') ; @@ -631,7 +631,7 @@ sub delete_exception_holiday_range { $sth->execute($self->{branchcode}, $options{day}, $options{month}, $options{year}); # changed the 'single_holidays' table, lets force/reset its cache - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; $cache->clear_from_cache( 'exception_holidays') ; } diff --git a/C4/Context.pm b/C4/Context.pm index baed4827a0..cb3c966160 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -511,7 +511,7 @@ with this method. =cut -my $syspref_cache = Koha::Cache->get_instance(); +my $syspref_cache = Koha::Caches->get_instance(); my $use_syspref_cache = 1; sub preference { my $self = shift; diff --git a/C4/External/OverDrive.pm b/C4/External/OverDrive.pm index 12135c582f..1093a1b12a 100644 --- a/C4/External/OverDrive.pm +++ b/C4/External/OverDrive.pm @@ -99,7 +99,7 @@ sub GetOverDriveToken { my $cache; - eval { $cache = Koha::Cache->get_instance() }; + eval { $cache = Koha::Caches->get_instance() }; my $token; $cache and $token = $cache->get_from_cache( "overdrive_token" ) and return $token; diff --git a/C4/Items.pm b/C4/Items.pm index 41bd03aeaa..dd7614cf9d 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -454,7 +454,7 @@ Returns item record sub _build_default_values_for_mod_marc { my ($frameworkcode) = @_; - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); my $cache_key = "default_value_for_mod_marc-$frameworkcode"; my $cached = $cache->get_from_cache($cache_key); return $cached if $cached; diff --git a/C4/Koha.pm b/C4/Koha.pm index bb3581123d..d82ad1e11b 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -1017,7 +1017,7 @@ sub GetAuthorisedValues { C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; my $cache_key = "AuthorisedValues-$category-$opac-$branch_limit"; - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); my $result = $cache->get_from_cache($cache_key); return $result if $result; diff --git a/C4/Utils/DataTables/ColumnsSettings.pm b/C4/Utils/DataTables/ColumnsSettings.pm index a1078864c1..9e838d6ef9 100644 --- a/C4/Utils/DataTables/ColumnsSettings.pm +++ b/C4/Utils/DataTables/ColumnsSettings.pm @@ -9,7 +9,7 @@ use Koha::Cache; sub get_yaml { my $yml_path = C4::Context->config('intranetdir') . '/admin/columns_settings.yml'; - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); my $yaml = $cache->get_from_cache('ColumnsSettingsYaml'); unless ($yaml) { diff --git a/Koha/Calendar.pm b/Koha/Calendar.pm index 1321621d00..4b48ae2e69 100644 --- a/Koha/Calendar.pm +++ b/Koha/Calendar.pm @@ -55,7 +55,7 @@ sub _init { sub exception_holidays { my ( $self ) = @_; - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); my $cached = $cache->get_from_cache('exception_holidays'); return $cached if $cached; @@ -84,7 +84,7 @@ sub exception_holidays { sub single_holidays { my ( $self, $date ) = @_; my $branchcode = $self->{branchcode}; - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); my $single_holidays = $cache->get_from_cache('single_holidays'); # $single_holidays looks like: diff --git a/Koha/Template/Plugin/Cache.pm b/Koha/Template/Plugin/Cache.pm index dbb1c82f49..5e3f8f7d77 100644 --- a/Koha/Template/Plugin/Cache.pm +++ b/Koha/Template/Plugin/Cache.pm @@ -35,7 +35,7 @@ sub new { } else { require Koha::Cache; - $cache = Koha::Cache->get_instance(); + $cache = Koha::Caches->get_instance(); } my $self = bless { CACHE => $cache, diff --git a/admin/biblio_framework.pl b/admin/biblio_framework.pl index 3aeb0cab48..57839b99f2 100755 --- a/admin/biblio_framework.pl +++ b/admin/biblio_framework.pl @@ -31,7 +31,7 @@ use Koha::Cache; my $input = new CGI; my $frameworkcode = $input->param('frameworkcode') || q||; my $op = $input->param('op') || q|list|; -my $cache = Koha::Cache->get_instance(); +my $cache = Koha::Caches->get_instance(); my @messages; my ( $template, $borrowernumber, $cookie ) = get_template_and_user( diff --git a/admin/koha2marclinks.pl b/admin/koha2marclinks.pl index 9ccca3722b..d8fd569987 100755 --- a/admin/koha2marclinks.pl +++ b/admin/koha2marclinks.pl @@ -59,7 +59,7 @@ else { } my $dbh = C4::Context->dbh; -my $cache = Koha::Cache->get_instance(); +my $cache = Koha::Caches->get_instance(); ################## ADD_FORM ################################## # called by default. Used to create form to add or modify a record diff --git a/admin/marc_subfields_structure.pl b/admin/marc_subfields_structure.pl index 096b9ec919..ea1373e2cc 100755 --- a/admin/marc_subfields_structure.pl +++ b/admin/marc_subfields_structure.pl @@ -77,7 +77,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( debug => 1, } ); -my $cache = Koha::Cache->get_instance(); +my $cache = Koha::Caches->get_instance(); my $op = $input->param('op') || ""; $tagfield =~ s/\,//g; diff --git a/admin/marctagstructure.pl b/admin/marctagstructure.pl index 2b4f2a194c..3ea47ed24b 100755 --- a/admin/marctagstructure.pl +++ b/admin/marctagstructure.pl @@ -46,7 +46,7 @@ my $pagesize = 20; my $script_name = "/cgi-bin/koha/admin/marctagstructure.pl"; my $dbh = C4::Context->dbh; -my $cache = Koha::Cache->get_instance(); +my $cache = Koha::Caches->get_instance(); # open template my ($template, $loggedinuser, $cookie) diff --git a/opac/svc/report b/opac/svc/report index bfc84e5c2a..9cc21a3fb9 100755 --- a/opac/svc/report +++ b/opac/svc/report @@ -41,7 +41,7 @@ die "Sorry this report is not public\n" unless $report_rec->{public}; my @sql_params = $query->param('sql_params'); -my $cache = Koha::Cache->get_instance(); +my $cache = Koha::Caches->get_instance(); my $cache_active = $cache->is_cache_active; my ($cache_key, $json_text); if ($cache_active) { diff --git a/svc/report b/svc/report index da1b9b3286..c7e4053d8e 100755 --- a/svc/report +++ b/svc/report @@ -48,7 +48,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); -my $cache = Koha::Cache->get_instance(); +my $cache = Koha::Caches->get_instance(); my $cache_active = $cache->is_cache_active; my ($cache_key, $json_text); if ($cache_active) { diff --git a/t/Calendar.t b/t/Calendar.t index 4d48c02f4f..75637538dc 100755 --- a/t/Calendar.t +++ b/t/Calendar.t @@ -89,7 +89,7 @@ fixtures_ok [ ], ], "add fixtures"; -my $cache = Koha::Cache->get_instance(); +my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; # 'MPL' branch is arbitrary, is not used at all but is needed for initialization diff --git a/t/db_dependent/Filter_MARC_ViewPolicy.t b/t/db_dependent/Filter_MARC_ViewPolicy.t index ba446bc079..709aea9d27 100644 --- a/t/db_dependent/Filter_MARC_ViewPolicy.t +++ b/t/db_dependent/Filter_MARC_ViewPolicy.t @@ -71,7 +71,7 @@ sub run_hiding_tests { $sth->execute($hidden_value); - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); $cache->flush_all(); # easy way to ensure DB is queried again. my $processor = Koha::RecordProcessor->new( diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t index b494a700f9..3e886e28a5 100755 --- a/t/db_dependent/Items.t +++ b/t/db_dependent/Items.t @@ -380,7 +380,7 @@ subtest 'SearchItems test' => sub { $dbh->do('INSERT INTO marc_subfield_structure (tagfield, tagsubfield, frameworkcode) VALUES (?, "z", ?)', undef, $itemfield, $frameworkcode); # Clear cache - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache("MarcStructure-0-$frameworkcode"); $cache->clear_from_cache("MarcStructure-1-$frameworkcode"); $cache->clear_from_cache("default_value_for_mod_marc-$frameworkcode"); @@ -644,7 +644,7 @@ subtest 'C4::Items::_build_default_values_for_mod_marc' => sub { |, undef, $framework->{frameworkcode} ); # And make sure the caches are cleared - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache("MarcStructure-0-" . $framework->{frameworkcode}); $cache->clear_from_cache("MarcStructure-1-" . $framework->{frameworkcode}); $cache->clear_from_cache("default_value_for_mod_marc-" . $framework->{frameworkcode}); diff --git a/tools/newHolidays.pl b/tools/newHolidays.pl index eda4c1b530..f36f0e0e1b 100755 --- a/tools/newHolidays.pl +++ b/tools/newHolidays.pl @@ -129,6 +129,6 @@ sub add_holiday { } } # we updated the single_holidays table, so wipe its cache - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; } -- 2.39.5