Memoize-Expire-ByInstance
view release on metacpan or search on metacpan
lib/Memoize/Expire/ByInstance.pm view on Meta::CPAN
my $default_lifetime = $opts{LIFETIME} || 0;
my $default_num_uses = $opts{NUM_USES} || 0;
my $self =
{ _meta => { _hash_data => {}, _expire => { _default => { lifetime => $default_lifetime, num_uses => $default_num_uses, }, }, } };
$self->{_hash} = ( exists( $opts{HASH} ) && ref( $opts{HASH} ) eq 'HASH' ) ? $opts{HASH} : {};
bless( $self, $class );
# Memoize doesn't deal well with "memoize('Package::method', ...)"; hence it must be tied and memoized
# in the same package that its used in... kinda annoying for unit testing... but handy in that I can use caller
$self->__insert_destroy_wrapper( (caller)[0] ) if( $opts{AUTO_DESTROY} );
$self->_argument_seperator( $opts{ARGUMENT_SEPERATOR} || FILE_SEPERATOR );
return $self;
}
############################################################################################
## Reset num_uses and last_set_time, and store the new value.
############################################################################################
sub STORE
{
( run in 1.251 second using v1.01-cache-2.11-cpan-a3c8064c92c )