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