Trait ritecache::Cache[][src]

pub trait Cache<K, V, S, M> where
    K: Eq + Hash,
    S: BuildHasher,
    M: Meter<K, V>, 
{
Show 16 methods fn with_meter_and_hasher(cap: u64, meter: M, hash_builder: S) -> Self;
fn get<'a, Q: ?Sized>(&'a mut self, k: &Q) -> Option<&'a V>
    where
        K: Borrow<Q>,
        Q: Hash + Eq + ?Sized
;
fn get_mut<'a, Q: ?Sized>(&'a mut self, k: &Q) -> Option<&'a mut V>
    where
        K: Borrow<Q>,
        Q: Hash + Eq + ?Sized
;
fn peek<'a, Q: ?Sized>(&'a self, k: &Q) -> Option<&'a V>
    where
        K: Borrow<Q>,
        Q: Hash + Eq + ?Sized
;
fn peek_mut<'a, Q: ?Sized>(&'a mut self, k: &Q) -> Option<&'a mut V>
    where
        K: Borrow<Q>,
        Q: Hash + Eq + ?Sized
;
fn peek_by_policy(&self) -> Option<(&K, &V)>;
fn put(&mut self, k: K, v: V) -> Option<V>;
fn pop<Q: ?Sized>(&mut self, k: &Q) -> Option<V>
    where
        K: Borrow<Q>,
        Q: Hash + Eq + ?Sized
;
fn pop_by_policy(&mut self) -> Option<(K, V)>;
fn contains<Q: ?Sized>(&self, k: &Q) -> bool
    where
        K: Borrow<Q>,
        Q: Hash + Eq + ?Sized
;
fn len(&self) -> usize;
fn is_empty(&self) -> bool;
fn capacity(&self) -> u64;
fn set_capacity(&mut self, cap: u64);
fn size(&self) -> u64;
fn clear(&mut self);
}
Expand description

A trait for a cache.

Required methods

Implementors