# Trait actix_session::storage::SessionStore

source · [−]

    pub trait SessionStore {
        fn load<'life0, 'life1, 'async_trait>(
            &'life0 self,
            session_key: &'life1 SessionKey
        ) -> Pin<Box<dyn Future<Output = Result<Option<HashMap<String, String>>, LoadError>> + 'async_trait>>
        where
            'life0: 'async_trait,
            'life1: 'async_trait,
            Self: 'async_trait;
        fn save<'life0, 'life1, 'async_trait>(
            &'life0 self,
            session_state: HashMap<String, String>,
            ttl: &'life1 Duration
        ) -> Pin<Box<dyn Future<Output = Result<SessionKey, SaveError>> + 'async_trait>>
        where
            'life0: 'async_trait,
            'life1: 'async_trait,
            Self: 'async_trait;
        fn update<'life0, 'life1, 'async_trait>(
            &'life0 self,
            session_key: SessionKey,
            session_state: HashMap<String, String>,
            ttl: &'life1 Duration
        ) -> Pin<Box<dyn Future<Output = Result<SessionKey, UpdateError>> + 'async_trait>>
        where
            'life0: 'async_trait,
            'life1: 'async_trait,
            Self: 'async_trait;
        fn delete<'life0, 'life1, 'async_trait>(
            &'life0 self,
            session_key: &'life1 SessionKey
        ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>
        where
            'life0: 'async_trait,
            'life1: 'async_trait,
            Self: 'async_trait;
    }

Expand description

The interface to retrieve and save the current session data from/to the chosen storage backend.

You can provide your own custom session store backend by implementing this trait.

## Required methods

source

#### fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
session_key: &'life1 SessionKey
) -> Pin<Box<dyn Future<Output = Result<Option<HashMap<String, String>>, LoadError>> + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,

Loads the session state associated to a session key.

source

#### fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
session_state: HashMap<String, String>,
ttl: &'life1 Duration
) -> Pin<Box<dyn Future<Output = Result<SessionKey, SaveError>> + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,

Persist the session state for a newly created session.

Returns the corresponding session key.

source

#### fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
session_key: SessionKey,
session_state: HashMap<String, String>,
ttl: &'life1 Duration
) -> Pin<Box<dyn Future<Output = Result<SessionKey, UpdateError>> + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,

Updates the session state associated to a pre-existing session key.

source

#### fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
session_key: &'life1 SessionKey
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,

Deletes a session from the store.

## Implementors

source

### impl SessionStore for CookieSessionStore

source

### impl SessionStore for RedisActorSessionStore

source

### impl SessionStore for RedisSessionStore