pub trait SessionStore:
Send
+ Sync
+ 'static {
// Required methods
fn load<'a>(
&'a self,
session_id: &'a str,
) -> SessionFuture<'a, Option<HashMap<String, String>>>;
fn save(
&self,
session_id: String,
values: HashMap<String, String>,
ttl_secs: u64,
) -> SessionFuture<'_, ()>;
fn delete<'a>(&'a self, session_id: &'a str) -> SessionFuture<'a, bool>;
// Provided method
fn purge_expired(&self) -> usize { ... }
}Expand description
Pluggable asynchronous session backend (in-memory sharded, Redis, PostgreSQL, etc.).
Required Methods§
Sourcefn load<'a>(
&'a self,
session_id: &'a str,
) -> SessionFuture<'a, Option<HashMap<String, String>>>
fn load<'a>( &'a self, session_id: &'a str, ) -> SessionFuture<'a, Option<HashMap<String, String>>>
Provided Methods§
Sourcefn purge_expired(&self) -> usize
fn purge_expired(&self) -> usize
Evicts expired sessions and returns the number reclaimed.
§Returns
usize- Count of expired sessions purged.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl SessionStore for InMemorySessionStore
Implements SessionStore for InMemorySessionStore.