Struct multicache::MultiCache
[−]
[src]
pub struct MultiCache<K, V> { /* fields omitted */ }
Methods
impl<K, V> MultiCache<K, V>
[src]
fn new(bytesize: usize) -> MultiCache<K, V> where
K: Hash + Eq,
K: Hash + Eq,
Create a new cache which will at most hold a total of bytesize in elements
fn put(&self, key: K, value: V, bytes: usize) where
K: Hash + Eq,
K: Hash + Eq,
Add a new element by key/value with a given bytesize, if after inserting this element we would be going over the bytesize of the cache first enough elements are evicted for that to not be the case
fn get(&self, key: &K) -> Option<Arc<V>> where
K: Hash + Eq,
K: Hash + Eq,
Get an element from the cache, updating it so it's now the most recently used and thus the last to be evicted
fn alias(&self, existing: K, newkey: K) where
K: Hash + Eq,
K: Hash + Eq,
Alias a new key to an existing one
fn contains_key(&self, key: &K) -> bool where
K: Hash + Eq,
K: Hash + Eq,
Check if a given key exists in the cache