Skip to main content

SessionBackend

Trait SessionBackend 

Source
pub trait SessionBackend: Send + Sync {
    // Required methods
    fn save(&self, session: &PersistedSession) -> Result<()>;
    fn load(&self) -> Result<Option<PersistedSession>>;
    fn delete(&self) -> Result<()>;
    fn name(&self) -> &str;
}
Expand description

An abstraction over where and how session data is persisted.

Required Methods§

Source

fn save(&self, session: &PersistedSession) -> Result<()>

Persist the given session.

Source

fn load(&self) -> Result<Option<PersistedSession>>

Load a previously persisted session, or return None if none exists.

Source

fn delete(&self) -> Result<()>

Remove the stored session (e.g. on sign-out).

Source

fn name(&self) -> &str

Human-readable name of this backend (for log messages).

Implementors§