pub trait ExpiryStore: Store + Expiry + Send + Sync {
    fn set_expiring<'life0, 'async_trait>(
        &'life0 self,
        scope: Arc<[u8]>,
        key: Arc<[u8]>,
        value: Arc<[u8]>,
        expire_in: Duration
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait
, { ... } fn get_expiring<'life0, 'async_trait>(
        &'life0 self,
        scope: Arc<[u8]>,
        key: Arc<[u8]>
    ) -> Pin<Box<dyn Future<Output = Result<Option<(Arc<[u8]>, Option<Duration>)>>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait
, { ... } }
Expand description

It is usefull for when store and expiry are implemented for the same struct, and should be implemented in those cases even if there can’t be any optimization, as it will prevent some runtime checks for expiry validity.

Provided Methods§

Set a key-value for a duration of time, if the key already exists, it should overwrite both the value and the expiry for that key.

Get the value and expiry for a key, it is possible to return None if the key doesn’t exist, or return None for the expiry if the key is persistent.

Implementations on Foreign Types§

Implementors§