Struct cached::stores::TimedCache [−][src]
pub struct TimedCache<K, V> { /* fields omitted */ }Cache store bound by time
Values are timestamped when inserted and are evicted if expired at time of retrieval.
Note: This cache is in-memory only
Methods
impl<K: Hash + Eq, V> TimedCache<K, V>[src]
impl<K: Hash + Eq, V> TimedCache<K, V>pub fn with_lifespan(seconds: u64) -> TimedCache<K, V>[src]
pub fn with_lifespan(seconds: u64) -> TimedCache<K, V>Creates a new TimedCache with a specified lifespan
pub fn with_lifespan_and_capacity(seconds: u64, size: usize) -> TimedCache<K, V>[src]
pub fn with_lifespan_and_capacity(seconds: u64, size: usize) -> TimedCache<K, V>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]
impl<K: Hash + Eq, V> Cached<K, V> for TimedCache<K, V>fn cache_get(&mut self, key: &K) -> Option<&V>[src]
fn cache_get(&mut self, key: &K) -> Option<&V>Attempt to retrieve a cached value
fn cache_set(&mut self, key: K, val: V)[src]
fn cache_set(&mut self, key: K, val: V)Insert a key, value pair
fn cache_remove(&mut self, k: &K) -> Option<V>[src]
fn cache_remove(&mut self, k: &K) -> Option<V>Remove a cached value
fn cache_clear(&mut self)[src]
fn cache_clear(&mut self)Remove all cached values
fn cache_size(&self) -> usize[src]
fn cache_size(&self) -> usizeReturn the current cache size (number of elements)
fn cache_hits(&self) -> Option<u32>[src]
fn cache_hits(&self) -> Option<u32>Return the number of times a cached value was successfully retrieved
fn cache_misses(&self) -> Option<u32>[src]
fn cache_misses(&self) -> Option<u32>Return the number of times a cached value was unable to be retrieved
fn cache_lifespan(&self) -> Option<u64>[src]
fn cache_lifespan(&self) -> Option<u64>Return the lifespan of cached values (time to eviction)
fn cache_capacity(&self) -> Option<usize>[src]
fn cache_capacity(&self) -> Option<usize>Return the cache capacity
Auto Trait Implementations
impl<K, V> Send for TimedCache<K, V> where
K: Send,
V: Send,
impl<K, V> Send for TimedCache<K, V> where
K: Send,
V: Send, impl<K, V> Sync for TimedCache<K, V> where
K: Sync,
V: Sync,
impl<K, V> Sync for TimedCache<K, V> where
K: Sync,
V: Sync,