Tie-Cacher
view release on metacpan or search on metacpan
This module implements a least recently used (LRU) cache in memory through
a tie and a OO interface. Any time a key/value pair is fetched or stored,
an entry time is associated with it, and as the cache fills up, those members
of the cache that are the oldest are removed to make room for new entries.
So, the cache only "remembers" the last written entries, up to the
size of the cache. This can be especially useful if you access
great amounts of data, but only access a minority of the data a
majority of the time.
The implementation is a hash, for quick lookups, overlaying a doubly linked
list for quick insertion and deletion. Notice that the OO interface will
be faster than the tie interface.
=head2 EXPORT
None
=head2 METHODS
Notice that in the methods you will see a number of places where a
This module implements a least recently used (LRU) cache in memory through
a tie and a OO interface. Any time a key/value pair is fetched or stored,
an entry time is associated with it, and as the cache fills up, those members
of the cache that are the oldest are removed to make room for new entries.
So, the cache only "remembers" the last written entries, up to the
size of the cache. This can be especially useful if you access
great amounts of data, but only access a minority of the data a
majority of the time.
The implementation is a hash, for quick lookups, overlaying a doubly linked
list for quick insertion and deletion. Notice that the OO interface will
be faster than the tie interface.
SYNOPSIS
# The Object Oriented interface:
use Tie::Cacher;
$cache = Tie::Cacher->new(%options);
$cache = Tie::Cacher->new(\%options);
( run in 2.343 seconds using v1.01-cache-2.11-cpan-49f99fa48dc )