Trait redact_data::cache::DataCacher[][src]

pub trait DataCacher: Clone + Send + Sync {
    #[must_use]
    fn set<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
        value: Data
    ) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str
    ) -> Pin<Box<dyn Future<Output = Result<Data, CacheError>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn exists<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str
    ) -> Pin<Box<dyn Future<Output = Result<bool, CacheError>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn expire<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
        seconds: usize
    ) -> Pin<Box<dyn Future<Output = Result<bool, CacheError>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
fn get_default_key_expiration_seconds(&self) -> usize; }
Expand description

The operations a redact cache struct must be able to fulfill.

Required methods

retrieves a cached value using the key

returns a boolean indicating whether an entry exists with a given key

sets the cache entry’s expiration in seconds

Implementations on Foreign Types

Allows an Arc<DataCacher> to act exactly like a DataCacher, dereferencing itself and passing calls through to the underlying DataCacher.

Implementors