Cache::Ref::LIFO(3pm)

πŸ“¦
version 0.04 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– Cache::Ref::LIFO πŸ’–

okay bestie, this is Cache::Ref::LIFO from the User Contributed Perl Documentation, and it is exactly what it says on the tin β€” a cache that saves stuff until it's full, then just... stops. no cap. let's get into it πŸŽ€


✨ NAME ✨

Cache::Ref::LIFO β€” Saves entries until full, discarding subsequent sets.

like literally that's the whole personality. she's simple. she's honest. she's full and she's DONE accepting new entries πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

my $c = Cache::Ref::LIFO->new( size => $n );

$c->set( foo => 42 );

$c->get("foo");

that's it. that's the whole API. build her with a size, set a thing, get a thing. iconic behavior, honestly 🌸


🌈 DESCRIPTION 🌈

so here's the tea β˜• β€” this is a very naive cache algorithm. it saves cache sets until the cache is full, at which point all additional saves which aren't a value update are discarded immediately. like, dropped. on the floor. gone. πŸ™ˆ

for very predictable workflows this is potentially a good fit β€” provided the MFU is used early on. (iykyk β€” if your most-frequently-used stuff shows up first, you're eating good πŸ“)

the advantage is that the code is very simple as a result. and honestly? simple is a vibe. main character energy is knowing when NOT to overcomplicate things πŸ’œ


πŸ‘‘ AUTHOR πŸ‘‘

Yuval Kogman


This software is copyright (c) 2010 by Yuval Kogman.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


and that's a wrap, bestie 🫢 this was documented for perl v5.32.0, dated 2021-01-07, and it lives in the User Contributed Perl Documentation corner of the universe. mwah. slay. periodt. βœ¨πŸ’…

πŸ“¦ where this page comes from