Store

Trait Store 

Source
pub trait Store: Send + Sync {
    type Value;

    // Required methods
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = SessionResult<Option<Self::Value>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn set<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
        value: Self::Value,
        duration: Duration,
    ) -> Pin<Box<dyn Future<Output = SessionResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn touch<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
        duration: Duration,
    ) -> Pin<Box<dyn Future<Output = SessionResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn remove<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = SessionResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

A generic store in which to write and retrive sessions either trough an in memory hashmap or a database connection.

Required Associated Types§

Source

type Value

Type that is associated with sessions.

The store will store and retrieve values of this type.

Required Methods§

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = SessionResult<Option<Self::Value>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the value from the store

Source

fn set<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, value: Self::Value, duration: Duration, ) -> Pin<Box<dyn Future<Output = SessionResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set the value from the store

Source

fn touch<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, duration: Duration, ) -> Pin<Box<dyn Future<Output = SessionResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Touch the value, refreshing its expiry time.

Source

fn remove<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = SessionResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove the value from the store.

Implementors§

Source§

impl<T> Store for MemoryStore<T>
where T: Send + Sync + Clone,

Source§

type Value = T