pod cleanup.
[p5sagit/p5-mst-13.2.git] / lib / Memoize / ExpireTest.pm
CommitLineData
a0cb3900 1
2# This is just for testing expiration semantics.
3# It's not actually a very good example of how to write
4# an expiration module.
5#
6# If you are looking for an example, I recommend that you look at the
7# simple example in the Memoize::Expire documentation, or at the
8# code for Memoize::Expire itself.
9#
10# If you have questions, I will be happy to answer them if you
11# send them to mjd-perl/memoize+@plover.com.
12
13package Memoize::ExpireTest;
14
15my %cache;
16
17sub TIEHASH {
18 my ($pack) = @_;
19 bless \%cache => $pack;
20}
21
22sub EXISTS {
23 my ($cache, $key) = @_;
24 exists $cache->{$key} ? 1 : 0;
25}
26
27sub FETCH {
28 my ($cache, $key) = @_;
29 $cache->{$key};
30}
31
32sub STORE {
33 my ($cache, $key, $val) = @_;
34 $cache->{$key} = $val;
35}
36
37sub expire {
38 my ($key) = @_;
39 delete $cache{$key};
40}
41
421;