Skip to content

Fast but lossy embedded multi-level LRU cache in Rust

Notifications You must be signed in to change notification settings

randombtree/sloppylru

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 

Repository files navigation

sloppylru - fast but lossy embedded multi-level LRU cache

Design targets

For efficient caching in e.g. DHT:s that can cache far-away keys with lower priority. Can lose LRU promotions on unexpected shutdowns, but keeps the key-store consistent. Still in early development, don't use!

Usage

Create a two-level LRU cache:

let manager = CacheManager::<2,64>::open(db_path)?;
let cache = manager.new_cache("my_cache", CacheConfig::default(1000))?;

Insert and retrieve index of key item.

let index = cache.insert(key, level).await;
...
if let Some(index) = cache.get(key, Some(level)) {
    // Has key
}

About

Fast but lossy embedded multi-level LRU cache in Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages