clock_cache

Crates.ioclock_cache
lib.rsclock_cache
version0.1.0
sourcesrc
created_at2017-01-03 22:18:07.449428
updated_at2017-01-03 22:18:07.449428
descriptionA CLOCK cache implementation
homepagehttps://github.com/jeromefroe/clock_cache
repositoryhttps://github.com/jeromefroe/clock_cache.git
max_upload_size
id7906
size14,602
Jerome Froelich (jeromefroe)

documentation

https://docs.rs/clock_cache/

README

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());
}
Commit count: 13

cargo fmt