pub struct LFUCache<K, V> { /* private fields */ }
Expand description
A hash set whose keys are ordered by frequency of access
Implementations§
Source§impl<K: Eq + Hash, V> LFUCache<K, V>
impl<K: Eq + Hash, V> LFUCache<K, V>
Sourcepub fn contains_key(&self, key: &K) -> bool
pub fn contains_key(&self, key: &K) -> bool
Return true
if the cache contains the given key.
Sourcepub fn bump(&mut self, key: &K) -> bool
pub fn bump(&mut self, key: &K) -> bool
Increase the given key
’s priority and return true
if present, otherwise false
.
Sourcepub fn insert(&mut self, key: K, value: V) -> Option<V>
pub fn insert(&mut self, key: K, value: V) -> Option<V>
Add a new value to the cache, and return the old value at key
, if any.
Auto Trait Implementations§
impl<K, V> Freeze for LFUCache<K, V>
impl<K, V> !RefUnwindSafe for LFUCache<K, V>
impl<K, V> Send for LFUCache<K, V>
impl<K, V> !Sync for LFUCache<K, V>
impl<K, V> Unpin for LFUCache<K, V>where
V: Unpin,
impl<K, V> UnwindSafe for LFUCache<K, V>where
K: RefUnwindSafe,
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