fbr_cache 0.1.1

A cache with frequency-based replacement strategy
Documentation
  • Coverage
  • 80%
    12 out of 15 items documented1 out of 12 items with examples
  • Size
  • Source code size: 21.31 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.93 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • rkuhn/fbr_cache
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • rkuhn

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:

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);