Trait actix_storage::dev::Expiry

source ·
pub trait Expiry: Send + Sync {
    fn persist<'life0, 'async_trait>(
        &'life0 self,
        scope: Arc<[u8]>,
        key: Arc<[u8]>
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait
; fn expire<'life0, 'async_trait>(
        &'life0 self,
        scope: Arc<[u8]>,
        key: Arc<[u8]>,
        expire_in: Duration
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait
; fn expiry<'life0, 'async_trait>(
        &'life0 self,
        scope: Arc<[u8]>,
        key: Arc<[u8]>
    ) -> Pin<Box<dyn Future<Output = Result<Option<Duration>>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait
; fn extend<'life0, 'async_trait>(
        &'life0 self,
        scope: Arc<[u8]>,
        key: Arc<[u8]>,
        expire_in: Duration
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait
, { ... } fn set_called<'life0, 'async_trait>(
        &'life0 self,
        key: Arc<[u8]>
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait
, { ... } }
Expand description

Set of method for expiry providers to implement.

The expiry itself should guarantee that it’s working on the correct storage and provide a hint that it’s persistant or temprorary.

Required Methods§

Remove all expiry requests from a key and make it persistent, the persistenty can be overwriten by calling expire on the key.

Sets an expiry for a key, the key may or may not be removed based on implementation, but it should be guaranteed that it won’t appear in get based methods or contains checks after the period specified.

Gets expiry for a key, returning None means it doesn’t have an expiry, if the provider can’t return an expiry, it should return an error instead. The result of this function can have some error, but it should be documented.

Provided Methods§

Extend expiry for a key for another duration of time. If the key doesn’t have an expiry, it should be equivalent of calling expire.

A notification that should be implemented if expiry is a different entity that store itself to remove expiry when set is called for a key.

Implementations on Foreign Types§

Implementors§