[Rt-commit] [svn] r1775 -
DBIx-SearchBuilder/trunk/SearchBuilder/Record
autrijus at pallas.eruditorum.org
autrijus at pallas.eruditorum.org
Wed Nov 10 04:07:51 EST 2004
Author: autrijus
Date: Wed Nov 10 04:07:50 2004
New Revision: 1775
Modified:
DBIx-SearchBuilder/trunk/SearchBuilder/Record/Cachable.pm
Log:
* Initialize the _Class cache only when we are actually using it.
Modified: DBIx-SearchBuilder/trunk/SearchBuilder/Record/Cachable.pm
==============================================================================
--- DBIx-SearchBuilder/trunk/SearchBuilder/Record/Cachable.pm (original)
+++ DBIx-SearchBuilder/trunk/SearchBuilder/Record/Cachable.pm Wed Nov 10 04:07:50 2004
@@ -22,9 +22,6 @@
my ( $class, @args ) = @_;
my $self = $class->SUPER::new(@args);
- # Cache it since we're gonna look at it a _lot_
- $self->{'_Class'} = ref($self);
-
return ($self);
}
@@ -50,17 +47,17 @@
sub _KeyCache {
my $self = shift;
- my $cache = $self->_Handle->DSN . "-KEYS--" . $self->{'_Class'};
- $self->_SetupCache($cache) unless exists ($_CACHES{$cache});
- return ( $_CACHES{ $cache});
+ my $cache = $self->_Handle->DSN . "-KEYS--" . ($self->{'_Class'} ||= ref($self));
+ $self->_SetupCache($cache) unless exists ($_CACHES{$cache});
+ return ($_CACHES{$cache});
}
sub _RecordCache {
my $self = shift;
- my $cache = $self->_Handle->DSN . "--" . $self->{'_Class'};
- $self->_SetupCache($cache) unless exists ($_CACHES{$cache});
- return ( $_CACHES{ $cache});
+ my $cache = $self->_Handle->DSN . "--" . ($self->{'_Class'} ||= ref($self));
+ $self->_SetupCache($cache) unless exists ($_CACHES{$cache});
+ return ($_CACHES{$cache});
}
More information about the Rt-commit
mailing list