From 296264efe6fcef702bf87e1bf6dba3ced81b9645 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Sun, 16 Oct 2011 18:39:00 -0400 Subject: [PATCH] Cache open-ils.fielder results by locale The problem was particularly visible in search facets, but existed before: the cache key used for fielder results did not take locale into account, so on a multi-locale system the first locale won and populated the cache for all other locales. Use a session locale if provided, otherwise default to the locale set in opensrf.xml Signed-off-by: Dan Scott Signed-off-by: Thomas Berezansky --- Open-ILS/src/perlmods/lib/OpenILS/Application/Fielder.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Fielder.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Fielder.pm index 38a56c55b5..341b569ed3 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Fielder.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Fielder.pm @@ -36,6 +36,7 @@ my $log = 'OpenSRF::Utils::Logger'; my $cache; my $cache_timeout; +my $default_locale; my $parser = XML::LibXML->new(); my $xslt = XML::LibXSLT->new(); @@ -56,6 +57,8 @@ sub initialize { $cache_timeout = $conf->config_value( "apps", "open-ils.fielder", "app_settings", "cache_timeout" ) || 300; + $default_locale = $conf->config_value("default", "default_locale") || 'en-US'; + generate_methods(); } @@ -68,6 +71,7 @@ sub fielder_fetch { my $client = shift; my $obj = shift; + my $locale = $self->session->session_locale || $default_locale; my $query = $obj->{query}; my $nocache = $obj->{cache} ? 0 : 1; my $fields = $obj->{fields}; @@ -98,7 +102,8 @@ sub fielder_fetch { $qstring . $fstring . $distinct . - $obj_class + $obj_class . + $locale ); $res = $cache->get_cache( $key ); -- 2.43.2