Cache::Ref::CAR(3pm)

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

✨ 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 πŸŽ€


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 πŸ™ˆ:

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