Time aware LFU (windowing, temporary immunity)

Moved from GitHub ristretto/46

Posted by andersfylling:

Would you consider adding a time aware LFU, such that completely new entries can’t have the probability of being evicted right after insertion?

Eg. New entries are given a 1 minute time frame to become useful. Potentially increasing survival rates of fresh entries.

karlmcguire commented :

Yes, we’ve experimented with different ways of calculating item value in the eviction process. One of which I’ve got my eye on is Hyperbolic caching, which lazily evaluates a hyperbolic function to derive item value. It would be easy to include creation time in the function and give items temporary eviction immunity.

We’ll look into it more, thanks for the suggestion.

ben-manes commented :

An admission window serves a similar purpose by delaying the evaluation until the item has been idle for a number of accesses. You might compare to that scheme (W-TinyLfu).

andersfylling commented :

An admission window serves a similar purpose by delaying the evaluation until the item has been idle for a number of accesses.

But will this allow increasing the LFU params of the delayed items?

Hyperbolic caching looks awesome. I wanted to write a time aware weighted LFU for my own library. But I might just switch to this as it seems you guys have really put some effort into it.

ben-manes commented :

It would allow the item to build up its frequency if used or be discarded if not. An LRU trace favors a larger delay, whereas an MRU trace favors a lower delay. Hyperbolic, without tinylfu, performs wildly across different traces (see our adaptivity paper),