[Bps-public-commit] dbix-searchbuilder branch, master, updated. 1.56_03-4-gf8eb18d

Jesse Vincent jesse at bestpractical.com
Wed Aug 25 21:37:37 EDT 2010


The branch, master has been updated
       via  f8eb18d1ef0c91198073fe1fd84bc0b0abcba435 (commit)
      from  c0b2e4eda82541add9e4d80b33ecdae5f4adf2a0 (commit)

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

- Log -----------------------------------------------------------------
commit f8eb18d1ef0c91198073fe1fd84bc0b0abcba435
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Wed Aug 25 21:37:30 2010 -0400

    SB::Record::Cachable never really dealt with multiple DSNs in one cache
    anyway -- and it was expensive to calculate. Hardcode cache names.

diff --git a/SearchBuilder/Record/Cachable.pm b/SearchBuilder/Record/Cachable.pm
index 3ada315..1f20ec8 100755
--- a/SearchBuilder/Record/Cachable.pm
+++ b/SearchBuilder/Record/Cachable.pm
@@ -44,18 +44,6 @@ sub _SetupCache {
 }
 
 
-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 
@@ -75,20 +63,20 @@ Blow away this record type's key cache
 
 sub _FlushKeyCache {
     my $self = shift;
-    my $cache = $self->_KeyCacheName();
+    my $cache = ($self->{_class}||= ref($self))."-KEYS";
     return $self->_SetupCache($cache);
 }
 
 sub _KeyCache {
     my $self = shift;
-    my $cache = $self->_KeyCacheName();
-    return $_CACHES{$cache}? $_CACHES{$cache}: $self->_SetupCache($cache);
+    my $cache = ($self->{_class}||= ref($self))."-KEYS";
+    return $_CACHES{$cache} || $self->_SetupCache($cache);
 }
 
 sub _RecordCache {
     my $self = shift;
-    my $cache = $self->_RecordCacheName();
-    return $_CACHES{$cache}? $_CACHES{$cache}: $self->_SetupCache($cache);
+    my $cache = ($self->{_class}||= ref($self));
+    return $_CACHES{$cache} || $self->_SetupCache($cache);
 }
 
 # Function: LoadFromHash

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



More information about the Bps-public-commit mailing list