Author: Aaron Buhr
License: Apache-2.0 (see LICENSE)
Status: Private until publication
FRUCache is a hybrid cache eviction strategy that blends recency and frequency using a simple, configurable scoring mechanism. It maintains O(1) access efficiency and allows users to tune its behavior to favor recent or frequent accesses—or both.
This repo contains:
- 📘
fru_cache_technical_explainer.md: In-depth design and comparison - 🐍
fru_cache.py: Python implementation - 💠
fru_cache.cpp: C++ implementation - 🧪
fru_cache_benchmark.py: Benchmark comparing FRU with LRU - 📊
fru_vs_lru_performance.png: Sample benchmark result
weight += \alpha \cdot (tick - last_access)^\beta
\alpha: Controls the weight's growth\beta: Bias toward recency (0 = LFU,1 = balanced,>1 = recency)
- Configurable LFU/LRU hybrid
- No global decay or background cleanup
- Tracks evicted items for smarter reentry
- Easy-to-extend design
To benchmark in Python:
python fru_cache_benchmark.pyIf you use this cache or its design, please credit the author: Aaron Buhr – GitHub: @aaronmbuhr
Licensed under the Apache License, Version 2.0. See LICENSE for details.