pub trait SessionStore:
Send
+ Sync
+ 'static {
// Required methods
fn read<'a>(&'a self, id: &'a str) -> StoreFuture<'a, Option<Session>>;
fn write<'a>(&'a self, session: &'a Session) -> StoreFuture<'a, ()>;
fn destroy<'a>(&'a self, id: &'a str) -> StoreFuture<'a, ()>;
fn gc(&self) -> StoreFuture<'_, usize>;
fn lifetime(&self) -> Duration;
}Required Methods§
Sourcefn read<'a>(&'a self, id: &'a str) -> StoreFuture<'a, Option<Session>>
fn read<'a>(&'a self, id: &'a str) -> StoreFuture<'a, Option<Session>>
Load a session, or None if it is unknown or has expired.
Sourcefn write<'a>(&'a self, session: &'a Session) -> StoreFuture<'a, ()>
fn write<'a>(&'a self, session: &'a Session) -> StoreFuture<'a, ()>
Persist a session under its current id.
Sourcefn destroy<'a>(&'a self, id: &'a str) -> StoreFuture<'a, ()>
fn destroy<'a>(&'a self, id: &'a str) -> StoreFuture<'a, ()>
Remove a session. Called on logout and after an id rotation.
Sourcefn gc(&self) -> StoreFuture<'_, usize>
fn gc(&self) -> StoreFuture<'_, usize>
Drop everything past its lifetime, returning how many were removed.
Expired sessions are already refused by read, so this is housekeeping
rather than security: without it a busy site accumulates one dead file
per visitor, forever.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".