[Rt-commit] [svn] r1755 - in DBIx-SearchBuilder/trunk: .
SearchBuilder/Record
jesse at pallas.eruditorum.org
jesse at pallas.eruditorum.org
Mon Nov 8 22:37:40 EST 2004
Author: jesse
Date: Mon Nov 8 22:37:39 2004
New Revision: 1755
Modified:
DBIx-SearchBuilder/trunk/ (props changed)
DBIx-SearchBuilder/trunk/Changes
DBIx-SearchBuilder/trunk/SearchBuilder/Record/Cachable.pm
Log:
r8939 at tinbook: jesse | 2004-11-08T16:14:29.618362Z
- Refactoring of DBIx::SearchBuilder::Record::Cachable for performance
improvement
Modified: DBIx-SearchBuilder/trunk/Changes
==============================================================================
--- DBIx-SearchBuilder/trunk/Changes (original)
+++ DBIx-SearchBuilder/trunk/Changes Mon Nov 8 22:37:39 2004
@@ -7,7 +7,8 @@
into the database.
- Started adding lowercase method name aliases
- Minor refactoring of 'id' method for a stupid, tiny perf improvement
-
+ - Refactoring of DBIx::SearchBuilder::Record::Cachable for performance
+ improvement
1.12
- Better error handling for some query build failure cases
Modified: DBIx-SearchBuilder/trunk/SearchBuilder/Record/Cachable.pm
==============================================================================
--- DBIx-SearchBuilder/trunk/SearchBuilder/Record/Cachable.pm (original)
+++ DBIx-SearchBuilder/trunk/SearchBuilder/Record/Cachable.pm Mon Nov 8 22:37:39 2004
@@ -22,16 +22,8 @@
my ( $class, @args ) = @_;
my $self = $class->SUPER::new(@args);
- $self->{'_Class'} =
- ref($self); # Cache it since we're gonna look at it a _lot_
-
- if ( $self->can('_CacheConfig') ) {
- $self->{'_CacheConfig'} = $self->_CacheConfig();
- }
- else {
- $self->{'_CacheConfig'} = __CachableDefaults::_CacheConfig();
- }
-
+ # Cache it since we're gonna look at it a _lot_
+ $self->{'_Class'} = ref($self);
return ($self);
}
@@ -40,7 +32,7 @@
my $self = shift;
my $cache = shift;
$_CACHES{$cache} = Cache::Simple::TimedExpiry->new();
- $_CACHES{$cache}->expire_after( $self->{'_CacheConfig'}{'cache_for_sec'} );
+ $_CACHES{$cache}->expire_after( $self->_CacheConfig->{'cache_for_sec'} );
}
sub _KeyCache {
@@ -158,7 +150,9 @@
sub _fetch () {
my ( $self, $cache_key ) = @_;
my $data = $self->_RecordCache->fetch($cache_key) or return;
- @{$self}{keys %$data} = values %$data; # deserialize
+ %$self = %$data; #deserialize it
+
+ #@{$self}{keys %$data} = values %$data; # deserialize
return 1;
}
@@ -201,7 +195,8 @@
sub _gen_alternate_RecordCache_key {
my ( $self, %attr ) = @_;
- my $cache_key = $self->Table() . ':';
+ #return( Storable::nfreeze( %attr));
+ my $cache_key;
while ( my ( $key, $value ) = each %attr ) {
$key ||= '__undef';
$value ||= '__undef';
@@ -225,7 +220,7 @@
sub _fetch_RecordCache_key {
my ($self) = @_;
- my $cache_key = $self->{'_CacheConfig'}{'cache_key'};
+ my $cache_key = $self->_CacheConfig->{'cache_key'};
return ($cache_key);
}
@@ -281,8 +276,6 @@
}
-package __CachableDefaults;
-
sub _CacheConfig {
{
'cache_p' => 1,
More information about the Rt-commit
mailing list