[Jifty-commit] r1454 - Jifty-DBI/trunk/lib/Jifty/DBI/Record
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Mon Jul 3 02:13:50 EDT 2006
Author: ruz
Date: Mon Jul 3 02:13:49 2006
New Revision: 1454
Modified:
Jifty-DBI/trunk/lib/Jifty/DBI/Record/Cachable.pm
Log:
::Cachable::_primary_record_cache_key
* avoid check for $self->id definess as if it's undef then
record couldn't have pk cache key
* use $self->primary_keys to get columns of the PK and its
values, as result we get support for compound PKs here
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 Mon Jul 3 02:13:49 2006
@@ -263,20 +263,17 @@
sub _primary_record_cache_key {
my ($self) = @_;
- return unless ( defined $self->id );
-
unless ( $self->{'_jifty_cache_pkey'} ) {
- my $primary_record_cache_key = $self->table() . ':';
my @attributes;
- foreach my $key ( @{ $self->_primary_keys } ) {
- push @attributes, $key . '=' . $self->SUPER::__value($key);
+ my %pk = $self->primary_keys;
+ while ( my ($key, $value) = each %pk ) {
+ return unless defined $value;
+ push @attributes, lc( $key ) . '=' . $value;
}
- $primary_record_cache_key .= join( ',', @attributes );
-
- $self->{'_jifty_cache_pkey'}
- = $primary_record_cache_key;
+ $self->{'_jifty_cache_pkey'} = $self->table .':'
+ . join ',', @attributes;
}
return ( $self->{'_jifty_cache_pkey'} );
More information about the Jifty-commit
mailing list