pub struct CarCache<K, V> { /* private fields */ }Expand description
CAR Cache implementation following the exact pseudocode
Implementations§
Source§impl<K, V> CarCache<K, V>
impl<K, V> CarCache<K, V>
Sourcepub fn get(&mut self, key: &K) -> Option<&V>
pub fn get(&mut self, key: &K) -> Option<&V>
Get value from cache Returns Some(value) if found, None if not in cache
Sourcepub fn put(&mut self, key: K, value: V) -> Option<Evicted<K, V>>
pub fn put(&mut self, key: K, value: V) -> Option<Evicted<K, V>>
Insert/update value in cache following the exact pseudocode
Returns Option<Evicted<K, V>> containing the evicted entry (key and value)
if an entry was evicted from the cache, or None if no eviction occurred.
Sourcepub const fn adaptation_parameter(&self) -> usize
pub const fn adaptation_parameter(&self) -> usize
Get current adaptation parameter
Auto Trait Implementations§
impl<K, V> Freeze for CarCache<K, V>
impl<K, V> RefUnwindSafe for CarCache<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for CarCache<K, V>
impl<K, V> Sync for CarCache<K, V>
impl<K, V> Unpin for CarCache<K, V>
impl<K, V> UnsafeUnpin for CarCache<K, V>
impl<K, V> UnwindSafe for CarCache<K, V>where
K: UnwindSafe,
V: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more