Skip to main content

DataSource

Trait DataSource 

Source
pub trait DataSource: Send + Sync {
    // Required methods
    fn load<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 CacheKey,
    ) -> Pin<Box<dyn Future<Output = Result<CacheValue>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn exists<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 CacheKey,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn keys<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<CacheKey>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Data source for cache warming

Required Methods§

Source

fn load<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 CacheKey, ) -> Pin<Box<dyn Future<Output = Result<CacheValue>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Load data for a key

Source

fn exists<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 CacheKey, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if key exists

Source

fn keys<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<CacheKey>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get all available keys

Implementors§