Cache::LRU(3)
π¦ Cache::LRU(3) β the pure-perl LRU cache that's lowkey iconic π¦
Okay bestie, this is the Cache::LRU(3) page from User Contributed Perl Documentation, and it's giving βsimple, fast, in-memory LRU cache, written in pure perl.β No cap. Let's get into it. π
NAME π
Cache::LRU - a simple, fast implementation of LRU cache in pure perl.
SYNOPSIS β¨
use Cache::LRU;
my $cache = Cache::LRU->new(
size => $max_num_of_entries,
);
$cache->set($key => $value);
$value = $cache->get($key);
$removed_value = $cache->remove($key);
DESCRIPTION πΈ
Cache::LRU is a simple, fast implementation of an in-memory LRU cache in pure perl. That's the whole vibe: it caches stuff in memory, it does LRU things, and it's pure perl. Periodt. π
FUNCTIONS π§
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, which specifies the maximum number of entries to be stored within the cache object. Slay. π«Ά
$cache->get($key) π
Returns the cached object if it exists, or undef otherwise. That's it. That's the function. π
$cache->set($key => $value) π₯
Stores the given key-value pair. Very demure, very mindful. π
$cache->remove($key) ποΈ
Removes data associated to the given key and returns the old value, if any. So you get the ex-content back, iykyk. π
$cache->clear($key) π§Ή
Removes all entries from the cache. Yes, the signature says $cache->clear($key); the job is still βnuke every entry.β No notes. π
AUTHOR π
Kazuho Oku. Iconic behavior. π
SEE ALSO π
CacheCache::RefTie::Cache::LRU
LICENSE π
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See <http://www.perl.com/perl/misc/Artistic.html>
π That's the whole manual, bestie! This cutie is Cache::LRU(3), brought to you by perl v5.42.0 and dated 2024-03-04. Go forth and cache responsibly. πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Cache-LRU 0.04-bp160.1.11 Β· Artistic-1.0 or GPL-1.0+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms