Struct cached::stores::TimedCache
[−]
[src]
pub struct TimedCache<K, V> { /* fields omitted */ }
Cache store bound by time - Values are timestamped when inserted and are expired on attempted retrieval.
Methods
impl<K: Hash + Eq, V> TimedCache<K, V>
[src]
fn with_lifespan(seconds: u64) -> TimedCache<K, V>
[src]
Creates a new TimedCache
with a specified lifespan
fn with_lifespan_and_capacity(seconds: u64, size: usize) -> TimedCache<K, V>
[src]
Creates a new TimedCache
with a specified lifespan and
cache-store with the specified pre-allocated capacity
Trait Implementations
impl<K: Hash + Eq, V> Cached<K, V> for TimedCache<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_lifespan(&self) -> Option<u64>
[src]
Return the lifespan of cached values (time to eviction)
fn cache_capacity(&self) -> Option<usize>
[src]
Return the cache capacity