Trait CacheMapExt

Source
pub trait CacheMapExt<K, V> {
    // Required methods
    fn get_with_timeout<Q>(&self, k: &Q) -> Option<&V>
       where K: Borrow<Q> + Ord,
             Q: Hash + Eq + Ord + ?Sized;
    fn get_with_timeout_mut<Q>(&mut self, k: &Q) -> Option<&mut V>
       where K: Borrow<Q> + Ord,
             Q: Hash + Eq + Ord + ?Sized;
    fn insert_with_timeout(
        &mut self,
        k: K,
        v: V,
        timeout: Option<Duration>,
    ) -> Option<V>;
    fn remove_expired_values(&mut self);
}

Required Methods§

Source

fn get_with_timeout<Q>(&self, k: &Q) -> Option<&V>
where K: Borrow<Q> + Ord, Q: Hash + Eq + Ord + ?Sized,

Source

fn get_with_timeout_mut<Q>(&mut self, k: &Q) -> Option<&mut V>
where K: Borrow<Q> + Ord, Q: Hash + Eq + Ord + ?Sized,

Source

fn insert_with_timeout( &mut self, k: K, v: V, timeout: Option<Duration>, ) -> Option<V>

Source

fn remove_expired_values(&mut self)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<K, V, S> CacheMapExt<K, V> for HashMap<K, TimedValue<V>, S>
where K: Eq + Hash, S: BuildHasher,

Source§

fn get_with_timeout<Q>(&self, k: &Q) -> Option<&V>
where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

Source§

fn get_with_timeout_mut<Q>(&mut self, k: &Q) -> Option<&mut V>
where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

Source§

fn insert_with_timeout( &mut self, k: K, v: V, timeout: Option<Duration>, ) -> Option<V>

Source§

fn remove_expired_values(&mut self)

Source§

impl<K, V, S> CacheMapExt<K, V> for DequeHashMap<K, TimedValue<V>, S>
where K: Hash + Eq + Ord + Clone, S: BuildHasher,

Source§

fn get_with_timeout<Q>(&self, k: &Q) -> Option<&V>
where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

Source§

fn get_with_timeout_mut<Q>(&mut self, k: &Q) -> Option<&mut V>
where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

Source§

fn insert_with_timeout( &mut self, k: K, v: V, timeout: Option<Duration>, ) -> Option<V>

Source§

fn remove_expired_values(&mut self)

Source§

impl<K: Ord + Clone, V> CacheMapExt<K, V> for DequeBTreeMap<K, TimedValue<V>>

Source§

fn get_with_timeout<Q>(&self, k: &Q) -> Option<&V>
where K: Borrow<Q>, Q: Ord + ?Sized,

Source§

fn get_with_timeout_mut<Q>(&mut self, k: &Q) -> Option<&mut V>
where K: Borrow<Q>, Q: Ord + ?Sized,

Source§

fn insert_with_timeout( &mut self, k: K, v: V, timeout: Option<Duration>, ) -> Option<V>

Source§

fn remove_expired_values(&mut self)

Source§

impl<K: Ord, V> CacheMapExt<K, V> for BTreeMap<K, TimedValue<V>>

Source§

fn get_with_timeout<Q>(&self, k: &Q) -> Option<&V>
where K: Borrow<Q>, Q: Ord + ?Sized,

Source§

fn get_with_timeout_mut<Q>(&mut self, k: &Q) -> Option<&mut V>
where K: Borrow<Q>, Q: Ord + ?Sized,

Source§

fn insert_with_timeout( &mut self, k: K, v: V, timeout: Option<Duration>, ) -> Option<V>

Source§

fn remove_expired_values(&mut self)

Implementors§