pub struct MemorySessionStore { /* private fields */ }Expand description
In-memory SessionStore backed by a HashMap.
This is the default store. Suitable for single-instance deployments. For horizontal scaling, use an external store that shares state across instances.
Implementations§
Source§impl MemorySessionStore
impl MemorySessionStore
Sourcepub async fn len(&self) -> usize
pub async fn len(&self) -> usize
Returns the number of records currently in the store.
Useful for metrics endpoints; not part of the SessionStore trait.
Sourcepub async fn cleanup_expired(&self) -> usize
pub async fn cleanup_expired(&self) -> usize
Remove all expired records. Returns the number removed.
Trait Implementations§
Source§impl Clone for MemorySessionStore
impl Clone for MemorySessionStore
Source§fn clone(&self) -> MemorySessionStore
fn clone(&self) -> MemorySessionStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MemorySessionStore
impl Debug for MemorySessionStore
Source§impl Default for MemorySessionStore
impl Default for MemorySessionStore
Source§fn default() -> MemorySessionStore
fn default() -> MemorySessionStore
Returns the “default value” for a type. Read more
Source§impl SessionStore for MemorySessionStore
impl SessionStore for MemorySessionStore
Source§fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 mut SessionRecord,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 mut SessionRecord,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a new session record. Read more
Source§fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 SessionRecord,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 SessionRecord,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Persist an existing session record. The ID is trusted.
Auto Trait Implementations§
impl !RefUnwindSafe for MemorySessionStore
impl !UnwindSafe for MemorySessionStore
impl Freeze for MemorySessionStore
impl Send for MemorySessionStore
impl Sync for MemorySessionStore
impl Unpin for MemorySessionStore
impl UnsafeUnpin for MemorySessionStore
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