[][src]Trait actix_storage::dev::ExpiryStore

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

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

#[must_use]fn set_expiring<'life0, 'async_trait>(
    &'life0 self,
    key: Arc<[u8]>,
    value: Arc<[u8]>,
    expire_in: Duration
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

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.

#[must_use]fn get_expiring<'life0, 'async_trait>(
    &'life0 self,
    key: Arc<[u8]>
) -> Pin<Box<dyn Future<Output = Result<Option<(Arc<[u8]>, Option<Duration>)>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

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.

Loading content...

Implementations on Foreign Types

impl<T> ExpiryStore for Addr<T> where
    T: Actor + Handler<ExpiryStoreRequest> + Handler<ExpiryRequest> + Handler<StoreRequest> + Sync + Send,
    T::Context: ToEnvelope<T, ExpiryStoreRequest> + ToEnvelope<T, ExpiryRequest> + ToEnvelope<T, StoreRequest>, 
[src]

Loading content...

Implementors

Loading content...