Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rkuhn/fbr_cache
A cache with frequency-based replacement strategy
https://github.com/rkuhn/fbr_cache
Last synced: about 2 months ago
JSON representation
A cache with frequency-based replacement strategy
- Host: GitHub
- URL: https://github.com/rkuhn/fbr_cache
- Owner: rkuhn
- Created: 2022-07-03T20:19:11.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-07-04T05:57:43.000Z (over 2 years ago)
- Last Synced: 2024-04-23T20:15:37.327Z (8 months ago)
- Language: Rust
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This crate implements a cache with frequency-based replacement strategy as described in the paper
“Data Cache Management Using Frequency-Based Replacement” by John T. Robinson and Murthy V. Devarakonda,
published in ACM SIGMETRICS 1990.The configuration parameters of such a cache are:
- **capacity:** the number of slots
- **A_max:** the maximum average frequency count beyond which counts are aged.
Aging will be performed roughly every _A_max * capacity_ cache hits.
100 is a reasonable default.
- **C_max:** the maximum frequency count for which eviction happens by count (above that: LRU).
You will probably not need to tune this.Example:
```rust
use fbr_cache::FbrCache;let mut cache = FbrCache::new(1000);
cache.put(1, "hello");
cache.put(2, "world");assert_eq!(cache.get(&1), Some(&"hello"));
assert_eq!(cache.len(), 2);
```