Struct cached::stores::UnboundCache [−][src]
pub struct UnboundCache<K, V> { /* fields omitted */ }Default unbounded cache
This cache has no size limit or eviction policy.
Note: This cache is in-memory only
Methods
impl<K: Hash + Eq, V> UnboundCache<K, V>[src]
impl<K: Hash + Eq, V> UnboundCache<K, V>pub fn new() -> UnboundCache<K, V>[src]
pub fn new() -> UnboundCache<K, V>Creates an empty UnboundCache
pub fn with_capacity(size: usize) -> UnboundCache<K, V>[src]
pub fn with_capacity(size: usize) -> UnboundCache<K, V>Creates an empty UnboundCache with a given pre-allocated capacity
Trait Implementations
impl<K: Hash + Eq, V> Cached<K, V> for UnboundCache<K, V>[src]
impl<K: Hash + Eq, V> Cached<K, V> for UnboundCache<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_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_capacity(&self) -> Option<usize>[src]
fn cache_capacity(&self) -> Option<usize>Return the cache capacity
fn cache_lifespan(&self) -> Option<u64>[src]
fn cache_lifespan(&self) -> Option<u64>Return the lifespan of cached values (time to eviction)
Auto Trait Implementations
impl<K, V> Send for UnboundCache<K, V> where
K: Send,
V: Send,
impl<K, V> Send for UnboundCache<K, V> where
K: Send,
V: Send, impl<K, V> Sync for UnboundCache<K, V> where
K: Sync,
V: Sync,
impl<K, V> Sync for UnboundCache<K, V> where
K: Sync,
V: Sync,