Struct cached::stores::SizedCache
[−]
[src]
pub struct SizedCache<K, V> { /* fields omitted */ }
Least Recently Used / Sized
Cache
- Stores up to a specified sized before beginning
to evict the least recently used keys
Methods
impl<K: Hash + Eq, V> SizedCache<K, V>
[src]
fn with_capacity(size: usize) -> SizedCache<K, V>
[src]
Creates a new SizedCache
with a given capacity
fn key_order(&self) -> Iter<K>
[src]
Trait Implementations
impl<K: Hash + Eq + Clone, V> Cached<K, V> for SizedCache<K, V>
[src]
fn cache_get(&mut self, key: &K) -> Option<&V>
[src]
Attempt to retrieve a cached value
fn cache_set(&mut self, key: K, val: V)
[src]
Insert a key, value pair
fn cache_size(&self) -> usize
[src]
Return the current cache size (number of elements)
fn cache_hits(&self) -> Option<u32>
[src]
Return the number of times a cached value was successfully retrieved
fn cache_misses(&self) -> Option<u32>
[src]
Return the number of times a cached value was unable to be retrieved
fn cache_capacity(&self) -> Option<usize>
[src]
Return the cache capacity
fn cache_lifespan(&self) -> Option<u64>
[src]
Return the lifespan of cached values (time to eviction)