#cache #count #zero #system #erase

count_cache

Counted cache system

2 releases

✓ Uses Rust 2018 edition

0.1.1 Mar 23, 2019
0.1.0 Mar 23, 2019

#64 in Caching

16 downloads per month

BSD-2-Clause

4KB
57 lines

Count Cache

Latest Version Build Status Deps

This create provide a simple way to use a counted cache system. When the count drop to zero, the cache delete the associated key, and the elements cannot be accessed anymore.

Here is an exemple:

use count_cache::CountCache;

fn main() {
    let ccache = CountCache::new();

    ccache.insert("test", 10.256, 2);
    assert_eq!(ccache.get(&"test").expect("Err"), 10.256);
    assert_eq!(ccache.get(&"test").expect("Err"), 10.256);
    assert!(ccache.get(&"test").is_err());
    assert!(ccache.get(&"test").is_err());
}

No runtime deps