moka-rs / moka

A high performance concurrent caching library for Rust
Apache License 2.0
1.61k stars 73 forks source link

Upgrade the cache policy from TinyLFU to W-TinyLFU #249

Open tatsuya6502 opened 1 year ago

tatsuya6502 commented 1 year ago

Currently, Moka cache uses TinyLFU as the admission/eviction policies (with a small buffer in front of the LFU filter). While it works well for many workloads like database, search, and analytics, it will not work well for recency-biased workloads, like job queues and event streams.

To provide better hit rate for such workloads, do the followings:

For more details, see the "Eviction Policy" chapter of an article about Java Caffeine cache: http://highscalability.com/blog/2019/2/25/design-of-a-modern-cachepart-deux.html

tatsuya6502 commented 6 months ago

I started to implement the Window-TinyLFU policy.