Trait actix_session::storage::SessionStore
source · pub trait SessionStore {
// Required methods
fn load(
&self,
session_key: &SessionKey
) -> impl Future<Output = Result<Option<HashMap<String, String>>, LoadError>>;
fn save(
&self,
session_state: HashMap<String, String>,
ttl: &Duration
) -> impl Future<Output = Result<SessionKey, SaveError>>;
fn update(
&self,
session_key: SessionKey,
session_state: HashMap<String, String>,
ttl: &Duration
) -> impl Future<Output = Result<SessionKey, UpdateError>>;
fn update_ttl(
&self,
session_key: &SessionKey,
ttl: &Duration
) -> impl Future<Output = Result<(), Error>>;
fn delete(
&self,
session_key: &SessionKey
) -> impl Future<Output = Result<(), Error>>;
}
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§
sourcefn load(
&self,
session_key: &SessionKey
) -> impl Future<Output = Result<Option<HashMap<String, String>>, LoadError>>
fn load( &self, session_key: &SessionKey ) -> impl Future<Output = Result<Option<HashMap<String, String>>, LoadError>>
Loads the session state associated to a session key.
sourcefn save(
&self,
session_state: HashMap<String, String>,
ttl: &Duration
) -> impl Future<Output = Result<SessionKey, SaveError>>
fn save( &self, session_state: HashMap<String, String>, ttl: &Duration ) -> impl Future<Output = Result<SessionKey, SaveError>>
Persist the session state for a newly created session.
Returns the corresponding session key.
sourcefn update(
&self,
session_key: SessionKey,
session_state: HashMap<String, String>,
ttl: &Duration
) -> impl Future<Output = Result<SessionKey, UpdateError>>
fn update( &self, session_key: SessionKey, session_state: HashMap<String, String>, ttl: &Duration ) -> impl Future<Output = Result<SessionKey, UpdateError>>
Updates the session state associated to a pre-existing session key.
sourcefn update_ttl(
&self,
session_key: &SessionKey,
ttl: &Duration
) -> impl Future<Output = Result<(), Error>>
fn update_ttl( &self, session_key: &SessionKey, ttl: &Duration ) -> impl Future<Output = Result<(), Error>>
Updates the TTL of the session state associated to a pre-existing session key.
Object Safety§
This trait is not object safe.