[−][src]Struct cached::stores::SizedCache
Least Recently Used / Sized
Cache
Stores up to a specified size before beginning to evict the least recently used keys
Note: This cache is in-memory only
Methods
impl<K: Hash + Eq, V> SizedCache<K, V>
[src]
pub fn with_capacity(size: usize) -> SizedCache<K, V>
[src]
Deprecated since 0.5.1:
method renamed to with_size
pub fn with_size(size: usize) -> SizedCache<K, V>
[src]
Creates a new SizedCache
with a given size limit and pre-allocated backing data
pub fn key_order(&self) -> impl Iterator<Item = &K>
[src]
Return an iterator of keys in the current order from most to least recently used.
pub fn value_order(&self) -> impl Iterator<Item = &V>
[src]
Return an iterator of values in the current order from most to least recently used.
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]
fn cache_get_mut(&mut self, key: &K) -> Option<&mut V>
[src]
fn cache_set(&mut self, key: K, val: V)
[src]
fn cache_remove(&mut self, k: &K) -> Option<V>
[src]
fn cache_clear(&mut self)
[src]
fn cache_reset(&mut self)
[src]
fn cache_size(&self) -> usize
[src]
fn cache_hits(&self) -> Option<u64>
[src]
fn cache_misses(&self) -> Option<u64>
[src]
fn cache_capacity(&self) -> Option<usize>
[src]
fn cache_lifespan(&self) -> Option<u64>
[src]
Auto Trait Implementations
impl<K, V> RefUnwindSafe for SizedCache<K, V> where
K: RefUnwindSafe,
V: RefUnwindSafe,
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for SizedCache<K, V> where
K: Send,
V: Send,
K: Send,
V: Send,
impl<K, V> Sync for SizedCache<K, V> where
K: Sync,
V: Sync,
K: Sync,
V: Sync,
impl<K, V> Unpin for SizedCache<K, V> where
K: Unpin,
V: Unpin,
K: Unpin,
V: Unpin,
impl<K, V> UnwindSafe for SizedCache<K, V> where
K: UnwindSafe,
V: UnwindSafe,
K: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,