[][src]Trait carapax_session::store::SessionStore

pub trait SessionStore {
    fn get<O>(
        &self,
        key: SessionKey
    ) -> Box<dyn Future<Item = Option<O>, Error = Error> + Send>
    where
        O: DeserializeOwned + Send + 'static
;
fn set<I>(
        &self,
        key: SessionKey,
        val: &I
    ) -> Box<dyn Future<Item = (), Error = Error> + Send>
    where
        I: Serialize
;
fn expire(
        &self,
        key: SessionKey,
        seconds: usize
    ) -> Box<dyn Future<Item = (), Error = Error> + Send>;
fn del(
        &self,
        key: SessionKey
    ) -> Box<dyn Future<Item = (), Error = Error> + Send>; }

Methods for accessing a store

Required methods

fn get<O>(
    &self,
    key: SessionKey
) -> Box<dyn Future<Item = Option<O>, Error = Error> + Send> where
    O: DeserializeOwned + Send + 'static, 

Get value of key

If key not exists, None is returned

fn set<I>(
    &self,
    key: SessionKey,
    val: &I
) -> Box<dyn Future<Item = (), Error = Error> + Send> where
    I: Serialize

Set key to hold the given value

fn expire(
    &self,
    key: SessionKey,
    seconds: usize
) -> Box<dyn Future<Item = (), Error = Error> + Send>

Set a timeout on key

After the timeout has expired, the key will automatically be deleted

fn del(
    &self,
    key: SessionKey
) -> Box<dyn Future<Item = (), Error = Error> + Send>

Remove the specified key

Loading content...

Implementors

Loading content...