You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Chris <ch...@prather.org> on 2002/08/20 11:25:59 UTC

Cache::Cache issues

Hi,

I've got a bit of an issue with Cache::Cache, and while I know it's a bit 
off topic my e-mail to the module maintianer has dissapeared into the 
nether regions of nowhere. I know that alot of people here use the module, 
especially since it was the cookbook and Perrin's articles that put me onto 
the module in the first place.

I can't seem to get the time-out on Cache objects to update, I'm not sure 
if it's a bug in Cache::Cache or a bug in my understanding of Cache:Cache's 
Cache::Object (much more likely).

I've written a small test script below that show's the issue I'm having. 
Any clue's would be helpful.

package TestExpiresAt;
use strict;
use Cache::MemoryCache;
our $Cache = Cache::MemoryCache->new({
                            'namespace'=>__PACKAGE__,
                            'default_expires_in' => 10,
                          });

$Cache->set('1', 'Yes', 1800);
$Cache->set('2', 'no');

my $timeout1 = $Cache->get_object('1')->get_expires_at();
my $timeout2 = $Cache->get_object('1')->get_expires_at();

print "$timeout1\n"; # this should be timeout2 + 1790
print "$timeout2\n"; # but it's not even different

$Cache->get_object('1')->set_expires_at("10 m");
$timeout1 = $Cache->get_object('1')->get_expires_at();

print "$timeout1\n"; # should be different again from timeout1 above
print "$timeout2\n"; # and from timeout 2

1;
__END__




Re: Cache::Cache issues

Posted by Chris <ch...@prather.org>.
> On Tue, 20 Aug 2002, Chris wrote:
> 
>> my $timeout1 = $Cache->get_object('1')->get_expires_at();
>> my $timeout2 = $Cache->get_object('1')->get_expires_at();
> 
> ... ETOOMUCHCUTNPASTE.
> 

Ick... My bad there. That explains one problem. Thanks.
Still I get the same values for $timeout before for:

$Cache->set('1', 'Yes', "5 m");
print $Cache->get_object('1')->get_expires_at(), "\n";
$Cache->get_object('1')->set_expires_at("10 m");
print $Cache->get_object('1')->get_expires_at();

Is this supposed to happen?

-Chris


Re: Cache::Cache issues

Posted by Ask Bjoern Hansen <as...@develooper.com>.
On Tue, 20 Aug 2002, Chris wrote:

> my $timeout1 = $Cache->get_object('1')->get_expires_at();
> my $timeout2 = $Cache->get_object('1')->get_expires_at();

... ETOOMUCHCUTNPASTE.

:-)


 - ask

-- 
ask bjoern hansen, http://www.askbjoernhansen.com/ !try; do();