clock_cache 0.1.0

A CLOCK cache implementation
Documentation
  • Coverage
  • 100%
    10 out of 10 items documented9 out of 10 items with examples
  • Size
  • Source code size: 14.98 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.55 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • jeromefroe/clock_cache
    2 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • jeromefroe

CLOCK Cache

Build Status Coverage Status License

An implemenation of a CLOCK cache as first described in [A Paging Experiment with the Multics System] (http://multicians.org/paging-experiment.pdf).

Example

Below is a simple example of how to instantiate a CLOCK cache.

extern crate clock_cache;

use clock_cache::ClockCache;

fn main() {
        let mut cache = ClockCache::new(2);
        cache.put("apple", "red");
        cache.put("banana", "yellow");

        assert_eq!(*cache.get(&"apple").unwrap(), "red");
        assert_eq!(*cache.get(&"banana").unwrap(), "yellow");
        assert!(cache.get(&"pear").is_none());

        cache.put("pear", "green");

        assert_eq!(*cache.get(&"pear").unwrap(), "green");
        assert_eq!(*cache.get(&"banana").unwrap(), "yellow");
        assert!(cache.get(&"apple").is_none());
}