Simple, fast implementation of LRU cache in pure perl
Perl 6
Switch branches/tags
Nothing to show
Latest commit 519e051 Oct 27, 2016 @fayland committed on GitHub Merge pull request #4 from zoffixznet/patch-1
Add mandatory "perl" META field
Failed to load latest commit information.
lib/Cache Make it more perl6-ish Jan 19, 2016
t Implement weak ref manually Jan 19, 2016
.travis.yml to fix Nov 1, 2015
META6.json Add mandatory "perl" META field Oct 26, 2016 add description Dec 5, 2015

perl6-Cache-LRU - Simple, fast implementation of LRU cache in pure perl

Build Status


use Cache::LRU;

my $cache = => 1024);

$cache->set($key, $value);

my $value = $cache->get($key);

my $removed_value = $cache->remove($key);


Cache::LRU is a simple, fast implementation of an in-memory LRU cache in pure perl.


Cache::LRU->new(size => $max_num_of_entries)

Creates a new cache object. Takes a hash as the only argument. The only parameter currently recognized is the "size" parameter that specifies the maximum number of entries to be stored within the cache object. size is default 1024.


Returns the cached object if exists, or undef otherwise.

$cache->set($key => $value)

Stores the given key-value pair.


Removes data associated to the given key and returns the old value, if any.


Removes all entries from the cache.