pub struct DatabaseSessionStore { /* private fields */ }Expand description
Sessions in a table.
The right default for more than one instance: every process reads the same rows, so a user stays logged in wherever the load balancer sends them.
Implementations§
Source§impl DatabaseSessionStore
impl DatabaseSessionStore
Sourcepub fn with_lifetime(self, lifetime: Duration) -> Self
pub fn with_lifetime(self, lifetime: Duration) -> Self
Sessions expiring after lifetime.
Sourcepub fn migrations() -> Migrator
pub fn migrations() -> Migrator
The migration this driver needs.
Merge it into the application’s migrator:
ⓘ
Migrator::new()
.create_table::<User>("0001_create_users")
.merge(DatabaseSessionStore::migrations())Trait Implementations§
Source§impl Debug for DatabaseSessionStore
impl Debug for DatabaseSessionStore
Source§impl SessionStore for DatabaseSessionStore
impl SessionStore for DatabaseSessionStore
Source§fn read<'a>(&'a self, id: &'a str) -> BoxFuture<'a, Result<Option<SessionData>>>
fn read<'a>(&'a self, id: &'a str) -> BoxFuture<'a, Result<Option<SessionData>>>
The data for this id, or
None if it is unknown or expired.Source§fn write<'a>(
&'a self,
id: &'a str,
data: &'a SessionData,
) -> BoxFuture<'a, Result<()>>
fn write<'a>( &'a self, id: &'a str, data: &'a SessionData, ) -> BoxFuture<'a, Result<()>>
Write the data back, refreshing its expiry.
Source§fn gc(&self) -> BoxFuture<'_, Result<u64>>
fn gc(&self) -> BoxFuture<'_, Result<u64>>
Discard every expired session. Called periodically, not per request.
Source§fn is_client_side(&self) -> bool
fn is_client_side(&self) -> bool
Whether the session travels in the cookie rather than being stored here. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for DatabaseSessionStore
impl !UnwindSafe for DatabaseSessionStore
impl Freeze for DatabaseSessionStore
impl Send for DatabaseSessionStore
impl Sync for DatabaseSessionStore
impl Unpin for DatabaseSessionStore
impl UnsafeUnpin for DatabaseSessionStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Event for T
impl<T> Event for T
Source§fn event_name() -> &'static strwhere
Self: Sized,
fn event_name() -> &'static strwhere
Self: Sized,
A human-readable name, used by wildcard listeners and log output.
Always the Rust type path; see the trait docs.