Skip to main content

SessionStore

Trait SessionStore 

Source
pub trait SessionStore:
    Send
    + Sync
    + 'static {
    // Required methods
    fn load<'a>(
        &'a self,
        id: &'a str,
        ttl_secs: u64,
    ) -> BoxFuture<'a, Option<Arc<Session>>>;
    fn save<'a>(
        &'a self,
        session: &'a Session,
        ttl_secs: u64,
    ) -> BoxFuture<'a, bool>;
    fn delete<'a>(&'a self, id: &'a str) -> BoxFuture<'a, bool>;
    fn new_id(&self) -> String;
}
Expand description

Backend store for sessions. Implement this to plug in Redis, Postgres, etc.

Required Methods§

Source

fn load<'a>( &'a self, id: &'a str, ttl_secs: u64, ) -> BoxFuture<'a, Option<Arc<Session>>>

Load a session by ID. ttl_secs is the manager’s configured lifetime and should be used to stamp the returned Session::expires_at so the in-memory expiry matches the store’s TTL configuration.

Source

fn save<'a>( &'a self, session: &'a Session, ttl_secs: u64, ) -> BoxFuture<'a, bool>

Source

fn delete<'a>(&'a self, id: &'a str) -> BoxFuture<'a, bool>

Source

fn new_id(&self) -> String

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§