Bugzilla – Attachment 10037 Details for
Bug 8092
Koha should use CHI caching framework
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8092: Cheer up Jenkins on loading Cache modules
Bug-8092-Cheer-up-Jenkins-on-loading-Cache-modules.patch (text/plain), 3.33 KB, created by
Jared Camins-Esakov
on 2012-06-09 14:57:25 UTC
(
hide
)
Description:
Bug 8092: Cheer up Jenkins on loading Cache modules
Filename:
MIME Type:
Creator:
Jared Camins-Esakov
Created:
2012-06-09 14:57:25 UTC
Size:
3.33 KB
patch
obsolete
>From c2a3be029c7cfa294b17b737ea699a5097ded699 Mon Sep 17 00:00:00 2001 >From: Jared Camins-Esakov <jcamins@cpbibliography.com> >Date: Sat, 9 Jun 2012 10:57:52 -0400 >Subject: [PATCH] Bug 8092: Cheer up Jenkins on loading Cache modules >Content-Type: text/plain; charset="UTF-8" > >--- > Koha/Cache.pm | 4 ++++ > Koha/Cache/Fastmmap.pm | 18 +++++++++++------- > Koha/Cache/Memory.pm | 20 ++++++++++++-------- > 3 files changed, 27 insertions(+), 15 deletions(-) > >diff --git a/Koha/Cache.pm b/Koha/Cache.pm >index 636d73e..740a133 100644 >--- a/Koha/Cache.pm >+++ b/Koha/Cache.pm >@@ -92,6 +92,7 @@ sub set_in_cache { > croak "No key" unless $key; > $ENV{DEBUG} && warn "set_in_cache for $key"; > >+ return unless $self->{cache}; > return unless $self->{have_chi}; > > if ( defined $expiry ) { >@@ -106,6 +107,7 @@ sub get_from_cache { > my ( $self, $key ) = @_; > croak "No key" unless $key; > $ENV{DEBUG} && warn "get_from_cache for $key"; >+ return unless $self->{cache}; > return unless $self->{have_chi}; > return $self->{cache}->get($key); > } >@@ -113,12 +115,14 @@ sub get_from_cache { > sub clear_from_cache { > my ( $self, $key ) = @_; > croak "No key" unless $key; >+ return unless $self->{cache}; > return unless $self->{have_chi}; > return $self->{cache}->remove($key); > } > > sub flush_all { > my $self = shift; >+ return unless $self->{cache}; > return unless $self->{have_chi}; > return $self->{cache}->clear(); > } >diff --git a/Koha/Cache/Fastmmap.pm b/Koha/Cache/Fastmmap.pm >index 10c4eb0..bad19f5 100644 >--- a/Koha/Cache/Fastmmap.pm >+++ b/Koha/Cache/Fastmmap.pm >@@ -20,19 +20,23 @@ package Koha::Cache::Fastmmap; > use strict; > use warnings; > use Carp; >-use CHI; >+use Module::Load::Conditional qw(can_load); > > use base qw(Koha::Cache); > > sub _cache_handle { > my $class = shift; > my $params = shift; >- return CHI->new( >- driver => 'FastMmap', >- namespace => $params->{'namespace'} || 'koha', >- expire_in => 600, >- cache_size => $params->{'cachesize'} || '1m', >- ); >+ if ( can_load( modules => { CHI => undef } ) ) { >+ return CHI->new( >+ driver => 'FastMmap', >+ namespace => $params->{'namespace'} || 'koha', >+ expire_in => 600, >+ cache_size => $params->{'cachesize'} || '1m', >+ ); >+ } else { >+ return undef; >+ } > } > > 1; >diff --git a/Koha/Cache/Memory.pm b/Koha/Cache/Memory.pm >index daeeb4a..da09765 100644 >--- a/Koha/Cache/Memory.pm >+++ b/Koha/Cache/Memory.pm >@@ -20,20 +20,24 @@ package Koha::Cache::Memory; > use strict; > use warnings; > use Carp; >-use CHI; >+use Module::Load::Conditional qw(can_load); > > use base qw(Koha::Cache); > > sub _cache_handle { > my $class = shift; > my $params = shift; >- return CHI->new( >- driver => 'Memory', >- namespace => $params->{'namespace'} || 'koha', >- expire_in => 600, >- max_size => $params->{'max_size'} || 8192 * 1024, >- global => 1, >- ); >+ if ( can_load( modules => { CHI => undef } ) ) { >+ return CHI->new( >+ driver => 'Memory', >+ namespace => $params->{'namespace'} || 'koha', >+ expire_in => 600, >+ max_size => $params->{'max_size'} || 8192 * 1024, >+ global => 1, >+ ); >+ } else { >+ return undef; >+ } > } > > 1; >-- >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 8092
:
9593
|
9595
|
9664
|
9802
|
10037
|
10093
|
10281