[Jifty-commit] r5624 - in Jifty-DBI/trunk: lib/Jifty/DBI/Record

Jifty commits jifty-commit at lists.jifty.org
Thu Jul 31 17:37:51 EDT 2008


Author: trs
Date: Thu Jul 31 17:37:50 2008
New Revision: 5624

Modified:
   Jifty-DBI/trunk/   (props changed)
   Jifty-DBI/trunk/lib/Jifty/DBI/Record/Cachable.pm

Log:
 r38353 at zot:  tom | 2008-07-31 17:37:07 -0400
 Cache on record table, not record class so subclasses also get cached correctly.  If the data in the underlying table changes, regardless of the class you're using, you want to load the new data.


Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Record/Cachable.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Record/Cachable.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Record/Cachable.pm	Thu Jul 31 17:37:50 2008
@@ -56,7 +56,7 @@
     my $self  = shift;
     my $cache = $self->_handle->dsn
         . "-KEYS--"
-        . ( $self->{'_class'} ||= ref($self) );
+        . ( $self->{'_class'} || $self->table );
     $self->_setup_cache($cache) unless exists( $_CACHES{$cache} );
     return ( $_CACHES{$cache} );
 
@@ -72,14 +72,14 @@
     my $self  = shift;
     my $cache = $self->_handle->dsn
         . "-KEYS--"
-        . ( $self->{'_class'} ||= ref($self) );
+        . ( $self->{'_class'} || $self->table );
     $self->_setup_cache($cache);
 }
 
 sub _record_cache {
     my $self = shift;
     my $cache
-        = $self->_handle->dsn . "--" . ( $self->{'_class'} ||= ref($self) );
+        = $self->_handle->dsn . "--" . ( $self->{'_class'} || $self->table );
     $self->_setup_cache($cache) unless exists( $_CACHES{$cache} );
     return ( $_CACHES{$cache} );
 


More information about the Jifty-commit mailing list