[][src]Struct tokio_cache::TimedCache

pub struct TimedCache<K, V> where
    K: Hash + Eq + Clone,
    V: Clone
{ /* fields omitted */ }

Methods

impl<K, V> TimedCache<K, V> where
    K: Hash + Eq + Clone,
    V: Clone
[src]

pub fn new(time_to_live: Duration) -> Self[src]

pub fn read<BK: ?Sized>(&self, key: &BK) -> Option<V> where
    BK: Hash + Eq,
    K: Borrow<BK>, 
[src]

Reads the cached entry for the given key.

Note that this will not block.

pub async fn write<'_, F, E>(&'_ self, key: K, future: F) -> Result<V, E> where
    F: Future<Output = Result<V, E>>, 
[src]

Trait Implementations

impl<K: Clone, V: Clone> Clone for TimedCache<K, V> where
    K: Hash + Eq + Clone,
    V: Clone
[src]

impl<K: Debug, V: Debug> Debug for TimedCache<K, V> where
    K: Hash + Eq + Clone,
    V: Clone
[src]

Auto Trait Implementations

impl<K, V> Send for TimedCache<K, V> where
    K: Send + Sync,
    V: Send + Sync

impl<K, V> Unpin for TimedCache<K, V>

impl<K, V> Sync for TimedCache<K, V> where
    K: Send + Sync,
    V: Send + Sync

impl<K, V> !UnwindSafe for TimedCache<K, V>

impl<K, V> !RefUnwindSafe for TimedCache<K, V>

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self