Struct cached::stores::UnboundCache
source · pub struct UnboundCache<K, V> { /* private fields */ }
Expand description
Default unbounded cache
This cache has no size limit or eviction policy.
Note: This cache is in-memory only
Implementations
sourceimpl<K: Hash + Eq, V> UnboundCache<K, V>
impl<K: Hash + Eq, V> UnboundCache<K, V>
sourcepub fn new() -> UnboundCache<K, V>
pub fn new() -> UnboundCache<K, V>
Creates an empty UnboundCache
sourcepub fn with_capacity(size: usize) -> UnboundCache<K, V>
pub fn with_capacity(size: usize) -> UnboundCache<K, V>
Creates an empty UnboundCache
with a given pre-allocated capacity
Trait Implementations
sourceimpl<K: Hash + Eq, V> Cached<K, V> for UnboundCache<K, V>
impl<K: Hash + Eq, V> Cached<K, V> for UnboundCache<K, V>
sourcefn cache_remove(&mut self, k: &K) -> Option<V>
fn cache_remove(&mut self, k: &K) -> Option<V>
Remove a cached value
sourcefn cache_clear(&mut self)
fn cache_clear(&mut self)
Remove all cached values
sourcefn cache_size(&self) -> usize
fn cache_size(&self) -> usize
Return the current cache size (number of elements)
sourcefn cache_hits(&self) -> Option<u32>
fn cache_hits(&self) -> Option<u32>
Return the number of times a cached value was successfully retrieved
sourcefn cache_misses(&self) -> Option<u32>
fn cache_misses(&self) -> Option<u32>
Return the number of times a cached value was unable to be retrieved
sourcefn cache_capacity(&self) -> Option<usize>
fn cache_capacity(&self) -> Option<usize>
Return the cache capacity
sourcefn cache_lifespan(&self) -> Option<u64>
fn cache_lifespan(&self) -> Option<u64>
Return the lifespan of cached values (time to eviction)
Auto Trait Implementations
impl<K, V> RefUnwindSafe for UnboundCache<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
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> Unpin for UnboundCache<K, V>where
K: Unpin,
V: Unpin,
impl<K, V> UnwindSafe for UnboundCache<K, V>where
K: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more