Skip to main content

LocalCache

Trait LocalCache 

Source
pub trait LocalCache<T: Clone>: Send + Sync {
    // Required method
    fn get_with<'a, 'life0, 'async_trait>(
        &'life0 self,
        key: String,
        future: Box<dyn Future<Output = T> + Send + 'a>,
    ) -> Pin<Box<dyn Future<Output = Result<T, CacheError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A local cache.

Required Methods§

Source

fn get_with<'a, 'life0, 'async_trait>( &'life0 self, key: String, future: Box<dyn Future<Output = T> + Send + 'a>, ) -> Pin<Box<dyn Future<Output = Result<T, CacheError>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait,

Gets a value.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: Clone + Send + Sync + 'static> LocalCache<T> for MokaCache<T>

Source§

impl<T: Clone + Send + Sync> LocalCache<T> for MemoryCache<T>