Cache::Ref::CAR(3pm)
β¨ NAME β¨
Cache::Ref::CAR β it's giving CLOCK with Adaptive Replacement π
(that's the Cache::Ref::CAR page in the perl manual, bestie π«Ά)
πΈ SYNOPSIS πΈ
my $c = Cache::Ref::CAR->new(
size => $n,
);
okay so that's literally the whole vibe check, you make one of these and hand it a size and you're off π
π¦ DESCRIPTION π¦
So this algorithm is a whole implementation of the paper at http://www.almaden.ibm.com/cs/people/dmodha/clockfast.pdf β yes bestie, actual academic literature, we're being so academic rn πβ¨
Also go peek at Cache::Ref::CART, which is probably more appropriate for random access work loads (iykyk, if your access pattern is chaotic that one might be your girlie πβοΈ).
The way CAR works: it balances between an MFU like policy and an MRU like policy, and it automatically tunes itself as the workload varies. Not me being self-adjusting, it's called being a main character π no cap, it just adapts on its own.
π ATTRIBUTES π
sizeβ the size of the live entries β¨
Heads up though: the cache also remembers this many expired keys, and it keeps some metadata about those keys too. So for memory usage, the overhead is probably around double what Cache::Ref::LRU requires. Double the drama, double the memory, that's the tradeoff ππ
π AUTHOR π
Yuval Kogman π
π COPYRIGHT AND LICENSE π
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. fr fr, slay π«Ά
π¨ POD ERRORS π¨
Hey! The above document had some coding errors, which are explained below π:
- Around line 174:
- alternative text
'http://www.almaden.ibm.com/cs/people/dmodha/clockfast.pdf'contains non-escaped|or/
- alternative text
like girl the link had a / in it and POD said absolutely not π iconic behavior honestly
perl v5.32.0 Β· 2021-01-07 Β· Cache::Ref::CAR(3pm)
and that's the whole page bestie, mwah π thanks for reading, go cache something responsibly π§β¨
π¦ where this page comes from
- debian bookworm: libcache-ref-perl 0.04-1.1
- debian trixie: libcache-ref-perl 0.04-1.1
- ubuntu jammy: libcache-ref-perl 0.04-1.1
- ubuntu noble: libcache-ref-perl 0.04-1.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms