Struct lru_time_cache::LruCache
[−]
[src]
pub struct LruCache<K, V> { // some fields omitted }
Provides a Last Recently Used caching algorithm in a container which may be limited by size or time, reordered to most recently seen.
Methods
impl<K, V> LruCache<K, V> where K: PartialOrd + Ord + Clone, V: Clone
[src]
Constructor for size (capacity) based LruCache
fn with_capacity(capacity: usize) -> LruCache<K, V>
fn with_expiry_duration(time_to_live: Duration) -> LruCache<K, V>
Constructor for time based LruCache
fn with_expiry_duration_and_capacity(time_to_live: Duration, capacity: usize) -> LruCache<K, V>
Constructor for dual feature capacity, or time based LruCache
fn add(&mut self, key: K, value: V)
Add a key/value pair to cache
fn remove(&mut self, key: K) -> Option<V>
Remove a key/value pair from cache
fn get(&mut self, key: K) -> Option<&V>
Retrieve a value from cache
fn check(&self, key: &K) -> bool
Check for existence of a key
fn len(&self) -> usize
Current size of cache