[Bps-public-commit] dbix-searchbuilder branch, negative-cache, updated. 81df97fb711077e9c37c8b700ac84449e1b267f0
Ruslan Zakirov
ruz at bestpractical.com
Fri Aug 14 10:22:49 EDT 2009
The branch, negative-cache has been updated
via 81df97fb711077e9c37c8b700ac84449e1b267f0 (commit)
from 5ffc2f934083c48f3b586c7bb9cbddeba619301e (commit)
Summary of changes:
SearchBuilder/Record/Cachable.pm | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
- Log -----------------------------------------------------------------
commit 81df97fb711077e9c37c8b700ac84449e1b267f0
Author: Ruslan Zakirov <ruz at bestpractica.com>
Date: Fri Aug 14 18:16:18 2009 +0400
first pass on negative caching
diff --git a/SearchBuilder/Record/Cachable.pm b/SearchBuilder/Record/Cachable.pm
index 59f7598..8dbc9e1 100755
--- a/SearchBuilder/Record/Cachable.pm
+++ b/SearchBuilder/Record/Cachable.pm
@@ -122,10 +122,22 @@ sub LoadByCols {
$self->_store();
# store alt_key as alias for pk
$self->_KeyCache->set( $alt_key, $self->_primary_RecordCache_key);
+ } else {
+ # use alternate key for negatives
+ $self->_store_under( $alt_key );
+ $self->_KeyCache->set( $alt_key, $alt_key );
}
return ( $rvalue, $msg );
}
+sub Create () {
+ my $self = shift;
+
+ $self->FlushCache;
+
+ return $self->SUPER::Create( @_ );
+}
+
# Function: __Set
# Type : (overloaded) public instance
# Args : see DBIx::SearchBuilder::Record::_Set
@@ -195,6 +207,13 @@ sub _store (\$) {
return 1;
}
+sub _store_under {
+ my $self = shift;
+ my $key = shift;
+ $self->_RecordCache->set( $key, $self->_serialize );
+ return 1;
+}
+
sub _serialize {
my $self = shift;
return {
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list