1*0Sstevel@tonic-gatepackage Memoize::ExpireTest; 2*0Sstevel@tonic-gate 3*0Sstevel@tonic-gate=head1 NAME 4*0Sstevel@tonic-gate 5*0Sstevel@tonic-gateMemoize::ExpireTest - test for Memoize expiration semantics 6*0Sstevel@tonic-gate 7*0Sstevel@tonic-gate=head1 DESCRIPTION 8*0Sstevel@tonic-gate 9*0Sstevel@tonic-gateThis module is just for testing expiration semantics. It's not a very 10*0Sstevel@tonic-gategood example of how to write an expiration module. 11*0Sstevel@tonic-gate 12*0Sstevel@tonic-gateIf you are looking for an example, I recommend that you look at the 13*0Sstevel@tonic-gatesimple example in the Memoize::Expire documentation, or at the code 14*0Sstevel@tonic-gatefor Memoize::Expire itself. 15*0Sstevel@tonic-gate 16*0Sstevel@tonic-gateIf you have questions, I will be happy to answer them if you send them 17*0Sstevel@tonic-gateto mjd-perl-memoize+@plover.com. 18*0Sstevel@tonic-gate 19*0Sstevel@tonic-gate=cut 20*0Sstevel@tonic-gate 21*0Sstevel@tonic-gate$VERSION = 0.65; 22*0Sstevel@tonic-gatemy %cache; 23*0Sstevel@tonic-gate 24*0Sstevel@tonic-gatesub TIEHASH { 25*0Sstevel@tonic-gate my ($pack) = @_; 26*0Sstevel@tonic-gate bless \%cache => $pack; 27*0Sstevel@tonic-gate} 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gatesub EXISTS { 30*0Sstevel@tonic-gate my ($cache, $key) = @_; 31*0Sstevel@tonic-gate exists $cache->{$key} ? 1 : 0; 32*0Sstevel@tonic-gate} 33*0Sstevel@tonic-gate 34*0Sstevel@tonic-gatesub FETCH { 35*0Sstevel@tonic-gate my ($cache, $key) = @_; 36*0Sstevel@tonic-gate $cache->{$key}; 37*0Sstevel@tonic-gate} 38*0Sstevel@tonic-gate 39*0Sstevel@tonic-gatesub STORE { 40*0Sstevel@tonic-gate my ($cache, $key, $val) = @_; 41*0Sstevel@tonic-gate $cache->{$key} = $val; 42*0Sstevel@tonic-gate} 43*0Sstevel@tonic-gate 44*0Sstevel@tonic-gatesub expire { 45*0Sstevel@tonic-gate my ($key) = @_; 46*0Sstevel@tonic-gate delete $cache{$key}; 47*0Sstevel@tonic-gate} 48*0Sstevel@tonic-gate 49*0Sstevel@tonic-gate1; 50