[Bps-public-commit] dbix-searchbuilder branch, master, updated. 1.56_03-3-gc0b2e4e

Jesse Vincent jesse at bestpractical.com
Mon Aug 23 14:38:23 EDT 2010


The branch, master has been updated
       via  c0b2e4eda82541add9e4d80b33ecdae5f4adf2a0 (commit)
       via  77633cb32a7927d1410bc309526d7291ac558cff (commit)
      from  aad56d6c329a7085aa88c7ba204439caa3ad93b2 (commit)

Summary of changes:
 SearchBuilder/Record/Cachable.pm |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

- Log -----------------------------------------------------------------
commit 77633cb32a7927d1410bc309526d7291ac558cff
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Mon Aug 23 13:52:17 2010 -0400

    Remove a use of indirect object syntax

diff --git a/SearchBuilder/Record/Cachable.pm b/SearchBuilder/Record/Cachable.pm
index 59f7598..4142a3a 100755
--- a/SearchBuilder/Record/Cachable.pm
+++ b/SearchBuilder/Record/Cachable.pm
@@ -38,7 +38,7 @@ my %_CACHES = ();
 
 sub _SetupCache {
     my ($self, $cache) = @_;
-    $_CACHES{$cache} = new Cache::Simple::TimedExpiry;
+    $_CACHES{$cache} = Cache::Simple::TimedExpiry->new();
     $_CACHES{$cache}->expire_after( $self->_CacheConfig->{'cache_for_sec'} );
     return $_CACHES{$cache};
 }

commit c0b2e4eda82541add9e4d80b33ecdae5f4adf2a0
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Mon Aug 23 14:39:24 2010 -0400

    Extract cache key names and cache them per object in RecordCache.

diff --git a/SearchBuilder/Record/Cachable.pm b/SearchBuilder/Record/Cachable.pm
index 4142a3a..3ada315 100755
--- a/SearchBuilder/Record/Cachable.pm
+++ b/SearchBuilder/Record/Cachable.pm
@@ -43,6 +43,19 @@ sub _SetupCache {
     return $_CACHES{$cache};
 }
 
+
+sub _RecordCacheName {
+   my $self = shift; 
+   return   $self->{_record_cache_name} ||= $self->_Handle->DSN . "-KEYS--" . ($self->{'_Class'} ||= ref $self);
+}
+
+
+sub _KeyCacheName {
+   my $self = shift; 
+   return   $self->{_key_cache_name} ||=  $self->_Handle->DSN . "--" . ($self->{'_Class'} ||= ref $self);
+}
+
+
 =head2 FlushCache
 
 This class method flushes the _global_ DBIx::SearchBuilder::Record::Cachable 
@@ -62,19 +75,19 @@ Blow away this record type's key cache
 
 sub _FlushKeyCache {
     my $self = shift;
-    my $cache = $self->_Handle->DSN . "-KEYS--" . ($self->{'_Class'} ||= ref $self);
+    my $cache = $self->_KeyCacheName();
     return $self->_SetupCache($cache);
 }
 
 sub _KeyCache {
     my $self = shift;
-    my $cache = $self->_Handle->DSN . "-KEYS--" . ($self->{'_Class'} ||= ref $self);
+    my $cache = $self->_KeyCacheName();
     return $_CACHES{$cache}? $_CACHES{$cache}: $self->_SetupCache($cache);
 }
 
 sub _RecordCache {
     my $self = shift;
-    my $cache = $self->_Handle->DSN . "--" . ($self->{'_Class'} ||= ref $self);
+    my $cache = $self->_RecordCacheName();
     return $_CACHES{$cache}? $_CACHES{$cache}: $self->_SetupCache($cache);
 }
 

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list