Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3744
Modified Files:
Action.pm
Log Message:
update some cache handling code...
Index: Action.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Action.pm,v
retrieving revision 1.57
retrieving revision 1.58
diff -C2 -d -r1.57 -r1.58
*** Action.pm 24 Oct 2004 15:50:14 -0000 1.57
--- Action.pm 31 Oct 2004 00:18:18 -0000 1.58
***************
*** 18,21 ****
--- 18,22 ----
use constant CACHE_CLASS_KEY => 'class_cache_track';
+ use constant CACHE_ALL_KEY => '__ALL__';
# TODO: Set default action security from server configuration?
***************
*** 252,256 ****
my $cached_content = $self->_check_cache;
! if ( $cached_content ) { return $cached_content }
$log->is_debug &&
$log->debug( "Cached data not found, continuing" );
--- 253,259 ----
my $cached_content = $self->_check_cache;
! if ( $cached_content ) {
! return $cached_content;
! }
$log->is_debug &&
$log->debug( "Cached data not found, continuing" );
***************
*** 558,570 ****
my ( $self, $cache_info ) = @_;
if ( ref $cache_info eq 'HASH' ) {
foreach my $task ( keys %{ $cache_info } ) {
my $time_spec = $cache_info->{ $task };
! $cache_info->{ $task } = $self->_translate_cache_time( $time_spec );
}
! $self->{cache_expire} = $cache_info;
}
elsif ( $cache_info ) {
my $cache_time = $self->_translate_cache_time( $cache_info );
! $self->{cache_expire} = { '_ALL_' => $cache_time };
}
return $self->{cache_expire};
--- 561,579 ----
my ( $self, $cache_info ) = @_;
if ( ref $cache_info eq 'HASH' ) {
+ my %new_info = ();
foreach my $task ( keys %{ $cache_info } ) {
my $time_spec = $cache_info->{ $task };
! $new_info{ $task } = $self->_translate_cache_time( $time_spec );
}
! $self->{cache_expire} = \%new_info;
}
elsif ( $cache_info ) {
my $cache_time = $self->_translate_cache_time( $cache_info );
! $self->{cache_expire} = { CACHE_ALL_KEY() => $cache_time };
! }
! if ( $cache_info ) {
! $log->info( "Assigned cache expiration: ",
! join( '; ', map { "$_ = $self->{cache_expire}{ $_ }" }
! keys %{ $self->{cache_expire} } ) );
}
return $self->{cache_expire};
***************
*** 626,631 ****
my ( $self ) = @_;
my $expire = $self->cache_expire;
! return unless ( $expire );
! return $expire->{ $self->task } || $expire->{'_ALL_'};
}
--- 635,644 ----
my ( $self ) = @_;
my $expire = $self->cache_expire;
! return unless ( ref $expire eq 'HASH' );
! my $time = $expire->{ $self->task } || $expire->{ CACHE_ALL_KEY() };
! $log->is_debug &&
! $log->debug( "Action/task ", $self->name, "/", $self->task, " ",
! "cached at time ", $time );
! return $time;
}
***************
*** 768,787 ****
sub property_assign {
my ( $self, $props ) = @_;
while ( my ( $field, $value ) = each %{ $props } ) {
! # This isn't defined in $PROPS
! if ( $field eq 'is_secure' ) {
! $self->is_secure( $value );
! }
!
! # ...neither are these
!
! elsif ( $field =~ /^(name|cache_expire)$/ ) {
$self->$field( $value );
}
! # ...everything else with a defined value (use property_clear
! # to set to undef)
!
elsif ( $PROPS{ $field } and defined $value ) {
$self->$field( $value );
--- 781,794 ----
sub property_assign {
my ( $self, $props ) = @_;
+ return unless ( ref $props eq 'HASH' );
while ( my ( $field, $value ) = each %{ $props } ) {
! # These aren't defined in %PROPS
! if ( $field =~ /^(cache_expire|is_secure|name)$/ ) {
$self->$field( $value );
}
! # ...everything else in %PROPS with a defined value (use
! # property_clear to set to undef)
elsif ( $PROPS{ $field } and defined $value ) {
$self->$field( $value );
|