From 3e1ca3a229020ee5ca6b23717cb5d4eb9bac8abd Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 15 Mar 2005 17:18:13 +0000 Subject: [PATCH] fully bypassing persist if persist isn't true git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@229 9efc2488-bf62-4759-914b-345cdb29e865 --- src/perlmods/OpenSRF/Utils/Cache.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/perlmods/OpenSRF/Utils/Cache.pm b/src/perlmods/OpenSRF/Utils/Cache.pm index fd212f0..5d2a29b 100644 --- a/src/perlmods/OpenSRF/Utils/Cache.pm +++ b/src/perlmods/OpenSRF/Utils/Cache.pm @@ -84,7 +84,7 @@ sub put_cache { my($self, $key, $value, $expiretime ) = @_; return undef unless( $key and $value ); - _load_methods(); + if($self->{persist}){ _load_methods(); } $expiretime ||= $max_persist_time; @@ -99,6 +99,8 @@ sub put_cache { ($slot) = $persist_slot_find->run("_CACHEVAL_$key"); if(!defined($slot)) { throw OpenSRF::EX::ERROR ("Unable to create cache slot $key in persist server" ); + } else { + #XXX destroy the slot and rebuild it to prevent DOS } } @@ -115,7 +117,7 @@ sub put_cache { sub delete_cache { my( $self, $key ) = @_; if(!$key) { return undef; } - _load_methods(); + if($self->{persist}){ _load_methods(); } $self->{memcache}->delete($key); if( $self->{persist} ) { $persist_destroy_slot->run("_CACHEVAL_$key"); @@ -129,7 +131,7 @@ sub get_cache { my $val = $self->{memcache}->get( $key ); return $val if defined($val); - _load_methods(); + if($self->{persist}){ _load_methods(); } # if not in memcache but we are persisting, the put it into memcache if( $self->{"persist"} ) { -- 2.11.0