Skip to content

czotti/count-cache-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Count Cache

Latest Version Build Status dependency status

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

About

Rust cache with a count to erase data when count is down to 0.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages