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.