Bugzilla – Attachment 7630 Details for
Bug 6193
Use memcached cache koha-conf.xml configuration variables
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 6193 - Follow up: use SetEnv and remove memcached from koha-conf.xml
Bug-6193---Follow-up-use-SetEnv-and-remove-memcach.patch (text/plain), 5.88 KB, created by
Jared Camins-Esakov
on 2012-02-13 16:25:59 UTC
(
hide
)
Description:
Bug 6193 - Follow up: use SetEnv and remove memcached from koha-conf.xml
Filename:
MIME Type:
Creator:
Jared Camins-Esakov
Created:
2012-02-13 16:25:59 UTC
Size:
5.88 KB
patch
obsolete
>From c924001753ce37f5bc75a28451e6677bd04e0c24 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Fri, 30 Dec 2011 09:10:36 -0300 >Subject: [PATCH] Bug 6193 - Follow up: use SetEnv and remove memcached from koha-conf.xml >Content-Type: text/plain; charset="UTF-8" > >Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com> >Confirmed that memcached is still being used after the memcached configuration >in koha-conf.xml was removed, and the following two lines were added to >both virtual hosts in koha-httpd.conf: >SetEnv MEMCACHED_SERVERS "127.0.0.1:11211" >SetEnv MEMCACHED_NAMESPACE "KOHA" >--- > C4/Auth.pm | 17 ++++------------- > C4/Biblio.pm | 11 ++++------- > C4/Context.pm | 25 +++++++++++++++++++++++++ > C4/Languages.pm | 14 ++++---------- > etc/koha-conf.xml | 2 -- > 5 files changed, 37 insertions(+), 32 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index e4bd119..f5c2294 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -35,7 +35,7 @@ use POSIX qw/strftime/; > use List::MoreUtils qw/ any /; > > # use utf8; >-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug $ldap $cas $caslogout $servers $memcached); >+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug $ldap $cas $caslogout); > > BEGIN { > sub psgi_env { any { /^psgi\./ } keys %ENV } >@@ -61,16 +61,7 @@ BEGIN { > if ($cas) { > import C4::Auth_with_cas qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url); > } >- $servers = C4::Context->config('memcached_servers'); >- if ($servers) { >- require Cache::Memcached; >- $memcached = Cache::Memcached->new({ >- servers => [ $servers ], >- debug => 0, >- compress_threshold => 10_000, >- namespace => C4::Context->config('memcached_namespace') || 'koha', >- }); >- } >+ > } > > =head1 NAME >@@ -1426,8 +1417,8 @@ sub get_session { > elsif ($storage_method eq 'Pg') { > $session = new CGI::Session("driver:PostgreSQL;serializer:yaml;id:md5", $sessionID, {Handle=>$dbh}); > } >- elsif ($storage_method eq 'memcached' && $servers){ >- $session = new CGI::Session("driver:memcached;serializer:yaml;id:md5", $sessionID, { Memcached => $memcached } ); >+ elsif ($storage_method eq 'memcached' && C4::Context->ismemcached){ >+ $session = new CGI::Session("driver:memcached;serializer:yaml;id:md5", $sessionID, { Memcached => C4::Context->memcached } ); > } > else { > # catch all defaults to tmp should work on all systems >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 98e4f5b..f936565 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -137,16 +137,13 @@ BEGIN { > } > > eval { >- my $servers = C4::Context->config('memcached_servers'); >- if ($servers) { >+ if (C4::Context->ismemcached) { > require Memoize::Memcached; > import Memoize::Memcached qw(memoize_memcached); > >- my $memcached = { >- servers => [$servers], >- key_prefix => C4::Context->config('memcached_namespace') || 'koha', >- }; >- memoize_memcached( 'GetMarcStructure', memcached => $memcached, expire_time => 600 ); #cache for 10 minutes >+ memoize_memcached( 'GetMarcStructure', >+ memcached => C4::Context->memcached, >+ expire_time => 600 ); #cache for 10 minutes > } > }; > >diff --git a/C4/Context.pm b/C4/Context.pm >index 770973f..74be361 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -253,6 +253,31 @@ sub read_config_file { # Pass argument naming config file to read > return $koha; # Return value: ref-to-hash holding the configuration > } > >+=head2 ismemcached >+ >+Returns the value of the $ismemcached variable (0/1) >+ >+=cut >+ >+sub ismemcached { >+ return $ismemcached; >+} >+ >+=head2 memcached >+ >+If $ismemcached is true, returns the $memcache variable. >+Returns undef otherwise >+ >+=cut >+ >+sub memcached { >+ if ($ismemcached) { >+ return $memcached; >+ } else { >+ return undef; >+ } >+} >+ > # db_scheme2dbi > # Translates the full text name of a database into de appropiate dbi name > # >diff --git a/C4/Languages.pm b/C4/Languages.pm >index 091d3bb..0cc288e 100644 >--- a/C4/Languages.pm >+++ b/C4/Languages.pm >@@ -26,19 +26,13 @@ use C4::Context; > use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG); > > eval { >- my $servers = C4::Context->config('memcached_servers'); >- if ($servers) { >+ if (C4::Context->ismemcached) { > require Memoize::Memcached; > import Memoize::Memcached qw(memoize_memcached); > >- my $memcached = { >- servers => [ $servers ], >- key_prefix => C4::Context->config('memcached_namespace') || 'koha', >- }; >- >- memoize_memcached('getTranslatedLanguages', memcached => $memcached, expire_time => 600); #cache for 10 minutes >- memoize_memcached('getFrameworkLanguages' , memcached => $memcached, expire_time => 600); >- memoize_memcached('getAllLanguages', memcached => $memcached, expire_time => 600); >+ memoize_memcached('getTranslatedLanguages', memcached => C4::Context->memcached, expire_time => 600); #cache for 10 minutes >+ memoize_memcached('getFrameworkLanguages' , memcached => C4::Context->memcached, expire_time => 600); >+ memoize_memcached('getAllLanguages', memcached => C4::Context->memcached, expire_time => 600); > } > }; > >diff --git a/etc/koha-conf.xml b/etc/koha-conf.xml >index 686a15b..f5e2c0f 100644 >--- a/etc/koha-conf.xml >+++ b/etc/koha-conf.xml >@@ -275,7 +275,5 @@ __PAZPAR2_TOGGLE_XML_POST__ > <pazpar2url>http://__PAZPAR2_HOST__:__PAZPAR2_PORT__/search.pz2</pazpar2url> > <install_log>__MISC_DIR__/koha-install-log</install_log> > <useldapserver>0</useldapserver><!-- see C4::Auth_with_ldap for extra configs you must add if you want to turn this on --> >- <memcached_servers>__MEMCACHED_SERVERS__</memcached_servers> >- <memcached_namespace>__MEMCACHED_NAMESPACE__</memcached_namespace> > </config> > </yazgfs> >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6193
:
3926
|
3927
|
5045
|
5537
|
5559
|
6971
| 7630