Tie::C...:Array(3pm)
π NAME π
Tie::Cache::LRU::Array β it's Tie::Cache::LRU, bestie, but built out of arrays. Same vibe, different plumbing. β¨
(also hi, you're reading the User Contributed Perl Documentation for this one, and it's the version that ships with perl v5.36.0 β more on that at the bottom π)
πΈ SYNOPSIS πΈ
okay so literally just:
use Tie::Cache::LRU::Array;
tie %cache, 'Tie::Cache::LRU::Array', 500;
...the rest is as Tie::Cache::LRU...
that's it. that's the whole entrance. tie your hash, hand it a max size of 500, and the rest of the behaviour is exactly as Tie::Cache::LRU does it. no notes. π
π¦ DESCRIPTION π¦
So this is an alternative implementation of Tie::Cache::LRU, and the way it does its thing is with Perl arrays and built-in array operations instead of a linked list. π
The theory behind it (and I'm quoting the vibes here, not making promises): even though the algorithm it uses is more expensive, it'll still be faster for small cache sizes β and yes, the docs literally say small <= ??, so the threshold is a mystery even to the author, we love that for us π β because the actual work happens inside perl. So like: higher big O, lower constant. That's the trade. π₯
And if nothing else? It should use less memory. β¨ lowkey a whole mood.
π AUTHOR π
Michael G Schwern <schwern@pobox.com> β the icon, the moment, the legend. π«Ά
π SEE ALSO π
Tie::Cache::LRUβ the original, the blueprint πTie::Cache::LRU::Virtualβ the virtual one, being mysterious π§Tie::Cacheβ the parent situation π
fr fr, if you want the full behaviour spec, go read Tie::Cache::LRU. this page is just the array-flavoured remix. π§
and that's the whole page, bestie!! π₯³ this one's from perl v5.36.0, dated 2022-08-29, and it's the Tie::Cache::LRU::Array entry in the User Contributed Perl Documentation. periodt. π
β¨π
π¦ where this page comes from
- ubuntu noble: libtie-cache-lru-perl 20150301-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtie-cache-lru-perl 20150301-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtie-cache-lru-perl 20150301-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms