CacheLoader

Trait CacheLoader 

Source
pub trait CacheLoader:
    Debug
    + Send
    + Sync
    + 'static {
    type K: Debug + Hash + Send + 'static;
    type V: Debug + Send + 'static;
    type Extra: Debug + Send + 'static;

    // Required method
    fn load<'life0, 'async_trait>(
        &'life0 self,
        k: Self::K,
        extra: Self::Extra,
    ) -> Pin<Box<dyn Future<Output = Self::V> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Loader for missing Cache entries.

Required Associated Types§

Source

type K: Debug + Hash + Send + 'static

Cache key.

Source

type V: Debug + Send + 'static

Cache value.

Source

type Extra: Debug + Send + 'static

Extra data needed when loading a missing entry. Specify () if not needed.

Required Methods§

Source

fn load<'life0, 'async_trait>( &'life0 self, k: Self::K, extra: Self::Extra, ) -> Pin<Box<dyn Future<Output = Self::V> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load value for given key, using the extra data if needed.

Trait Implementations§

Source§

impl<K, V, Extra> CacheLoader for Box<dyn CacheLoader<K = K, V = V, Extra = Extra>>
where K: Debug + Hash + Send + 'static, V: Debug + Send + 'static, Extra: Debug + Send + 'static,

Source§

type K = K

Cache key.
Source§

type V = V

Cache value.
Source§

type Extra = Extra

Extra data needed when loading a missing entry. Specify () if not needed.
Source§

fn load<'life0, 'async_trait>( &'life0 self, k: Self::K, extra: Self::Extra, ) -> Pin<Box<dyn Future<Output = Self::V> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load value for given key, using the extra data if needed.

Implementations on Foreign Types§

Source§

impl<K, V, Extra> CacheLoader for Box<dyn CacheLoader<K = K, V = V, Extra = Extra>>
where K: Debug + Hash + Send + 'static, V: Debug + Send + 'static, Extra: Debug + Send + 'static,

Source§

type K = K

Source§

type V = V

Source§

type Extra = Extra

Source§

fn load<'life0, 'async_trait>( &'life0 self, k: Self::K, extra: Self::Extra, ) -> Pin<Box<dyn Future<Output = Self::V> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§