Bugzilla – Attachment 49315 Details for
Bug 16105
Cache::Memory is loaded even if memcache is used
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16105: Do not initialize the memory cache if not needed
Bug-16105-Do-not-initialize-the-memory-cache-if-no.patch (text/plain), 3.18 KB, created by
Jonathan Druart
on 2016-03-18 13:42:05 UTC
(
hide
)
Description:
Bug 16105: Do not initialize the memory cache if not needed
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-03-18 13:42:05 UTC
Size:
3.18 KB
patch
obsolete
>From 15da626f284d9ba09d95b1d79803cabb061f7163 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 18 Mar 2016 13:39:27 +0000 >Subject: [PATCH] Bug 16105: Do not initialize the memory cache if not needed > >Cache::Memory is loaded and Koha::Cache::_initialize_memory is called >even if a memcached cache has been correctly initialize, it does not >make sense. >It should only be initialize if needed. > >Test plan: >Correctly configure a memcache server and confirm that the memory cache >is not initialize. >Do not configure correctly a memcache server and confirm that the cache >system default on Cache::Memory >--- > Koha/Cache.pm | 46 ++++++++++++++++------------------------------ > 1 file changed, 16 insertions(+), 30 deletions(-) > >diff --git a/Koha/Cache.pm b/Koha/Cache.pm >index e352624..3694f57 100644 >--- a/Koha/Cache.pm >+++ b/Koha/Cache.pm >@@ -81,43 +81,29 @@ sub new { > $self->{'timeout'} ||= 0; > $self->{'namespace'} ||= $ENV{MEMCACHED_NAMESPACE} || 'koha'; > >- if ( can_load( modules => { 'Cache::Memcached::Fast' => undef } ) ) { >- _initialize_memcached($self); >- if ( $self->{'default_type'} eq 'memcached' >- && defined( $self->{'memcached_cache'} ) ) >- { >- $self->{'cache'} = $self->{'memcached_cache'}; >- } >+ if ( $self->{'default_type'} eq 'memcached' >+ && can_load( modules => { 'Cache::Memcached::Fast' => undef } ) >+ && _initialize_memcached($self) >+ && defined( $self->{'memcached_cache'} ) ) >+ { >+ $self->{'cache'} = $self->{'memcached_cache'}; > } > > if ( $self->{'default_type'} eq 'fastmmap' > && defined( $ENV{GATEWAY_INTERFACE} ) >- && can_load( modules => { 'Cache::FastMmap' => undef } ) ) { >- _initialize_fastmmap($self); >- if ( defined( $self->{'fastmmap_cache'} ) ) >- { >- $self->{'cache'} = $self->{'fastmmap_cache'}; >- } >+ && can_load( modules => { 'Cache::FastMmap' => undef } ) >+ && _initialize_fastmmap($self) >+ && defined( $self->{'fastmmap_cache'} ) ) >+ { >+ $self->{'cache'} = $self->{'fastmmap_cache'}; > } > >- if ( can_load( modules => { 'Cache::Memory' => undef, nocache => 1 } ) ) { >- _initialize_memory($self); >- if ( $self->{'default_type'} eq 'memory' >- && defined( $self->{'memory_cache'} ) ) >- { >- $self->{'cache'} = $self->{'memory_cache'}; >- } >- } >- >- # Unless a default has already been picked, we go through in best-to- >- # least-best order, looking for something we can use. fastmmap_cache >- # is excluded because it doesn't support expiry in a useful way. >+ # Unless memcache or fastmmap has already been picked, use memory_cache > unless ( defined( $self->{'cache'} ) ) { >- foreach my $cachemember (qw(memcached_cache memory_cache )) { >- if ( defined( $self->{$cachemember} ) ) { >- $self->{'cache'} = $self->{$cachemember}; >- last; >- } >+ if ( can_load( modules => { 'Cache::Memory' => undef, nocache => 1 } ) >+ && _initialize_memory($self) ) >+ { >+ $self->{'cache'} = $self->{'memory_cache'}; > } > } > >-- >2.7.0
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 16105
:
49315
|
50260
|
50869
|
50911