Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 719 Bytes

README.md

File metadata and controls

30 lines (20 loc) · 719 Bytes

lfu_rs

An LFU cache for Rust. This is an implementation of the algorithm described in this paper.

Build Status

Usage

The LFUCache struct is similar to a typical HashMap.

// Initialize cache with size 10
let mut cache: LFUCache<K, V> = LFUCache::new(10);

// Insertion
// Returns the old value if this key already existed
cache.insert(K, V) // -> Option<V>

// Retrieval
myValue = c.get(&K) // -> Option<&V>

// Removal
c.remove(&K) // Option<V>

Running tests

$ cargo test --all