README
1NAME
2 Cache::LRU - a simple, fast implementation of LRU cache in pure perl
3
4SYNOPSIS
5 use Cache::LRU;
6
7 my $cache = Cache::LRU->new(
8 size => $max_num_of_entries,
9 );
10
11 $cache->set($key => $value);
12
13 $value = $cache->get($key);
14
15 $removed_value = $cache->remove($key);
16
17DESCRIPTION
18 Cache::LRU is a simple, fast implementation of an in-memory LRU cache in
19 pure perl.
20
21FUNCTIONS
22 Cache::LRU->new(size => $max_num_of_entries)
23 Creates a new cache object. Takes a hash as the only argument. The only
24 parameter currently recognized is the "size" parameter that specifies
25 the maximum number of entries to be stored within the cache object.
26
27 $cache->get($key)
28 Returns the cached object if exists, or undef otherwise.
29
30 $cache->set($key => $value)
31 Stores the given key-value pair.
32
33 $cache->remove($key)
34 Removes data associated to the given key and returns the old value, if
35 any.
36
37 $cache->clear($key)
38 Removes all entries from the cache.
39
40AUTHOR
41 Kazuho Oku
42
43SEE ALSO
44 Cache
45
46 Cache::Ref
47
48 Tie::Cache::LRU
49
50LICENSE
51 This program is free software; you can redistribute it and/or modify it
52 under the same terms as Perl itself.
53
54 See <http://www.perl.com/perl/misc/Artistic.html>
55
56