core_lib::cache

Trait Cache

Source
pub trait Cache<K, V> {
    // Required methods
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        k: &'life1 K,
    ) -> Pin<Box<dyn Future<Output = Result<Option<V>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn set<'life0, 'async_trait>(
        &'life0 self,
        k: K,
        v: V,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        k: &'life1 K,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Methods§

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, k: &'life1 K, ) -> Pin<Box<dyn Future<Output = Result<Option<V>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn set<'life0, 'async_trait>( &'life0 self, k: K, v: V, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, k: &'life1 K, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§

Source§

impl<K, V> Cache<K, V> for InMemCache<K, V>
where K: Eq + Hash + Sync + Send + Serialize, V: Clone + Sync + Send,