jaemk / cached

Rust cache structures and easy function memoization
MIT License
1.58k stars 96 forks source link

adaptive replacement cache #32

Open dvc94ch opened 4 years ago

dvc94ch commented 4 years ago

An adaptive replacement cache keeps both the most recently used (L1) and most frequently used (L2) in cache. The cache keeps a list of recently evicted cache entries (G1, G2). On a cache miss it checks if the entry is in G1 or G2 and adapts the target ratio of L1/L2 entries. When evicting it decides to evict from L1 or L2 by comparing the current ratio to the target ratio.

https://en.wikipedia.org/wiki/Adaptive_replacement_cache