Tie::C...:Array(3pm)

πŸ“¦
this version Β· 2 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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