pub struct MemoryStore { /* private fields */ }Expand description
Keeps sessions in memory, for tests. This store is the memory driver.
Clones share the same sessions, and the sessions are lost when the process exits.
Trait Implementations§
Source§impl Clone for MemoryStore
impl Clone for MemoryStore
Source§fn clone(&self) -> MemoryStore
fn clone(&self) -> MemoryStore
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 MemoryStore
impl Debug for MemoryStore
Source§impl Default for MemoryStore
impl Default for MemoryStore
Source§fn default() -> MemoryStore
fn default() -> MemoryStore
Returns the “default value” for a type. Read more
Source§impl SessionStore for MemoryStore
impl SessionStore for MemoryStore
Source§async fn read(
&self,
id: &str,
lifetime: Duration,
) -> Result<Option<String>, Error>
async fn read( &self, id: &str, lifetime: Duration, ) -> Result<Option<String>, Error>
The payload of the session
id. Returns None when the session is missing or has been
idle longer than lifetime. Read moreSource§async fn write(
&self,
id: &str,
payload: String,
_lifetime: Duration,
identity: &Identity,
write: Write,
) -> Result<(), Error>
async fn write( &self, id: &str, payload: String, _lifetime: Duration, identity: &Identity, write: Write, ) -> Result<(), Error>
Store a session’s payload. Stores that expire data themselves may use
lifetime. Stores
that keep who a session belongs to may use identity, which describes the request that
saves the session. Read moreSource§async fn destroy(&self, id: &str) -> Result<(), Error>
async fn destroy(&self, id: &str) -> Result<(), Error>
Remove the session
id, such as after its ID was regenerated. Read moreSource§async fn destroy_others(
&self,
user_id: &Value,
except: &str,
) -> Result<(), Error>
async fn destroy_others( &self, user_id: &Value, except: &str, ) -> Result<(), Error>
Remove every session of the user whose ID is
user_id, as Identity::user_id gives it,
except the session except. Read moreSource§async fn collect_garbage(&self, lifetime: Duration) -> Result<(), Error>
async fn collect_garbage(&self, lifetime: Duration) -> Result<(), Error>
Remove sessions that have been idle longer than
lifetime.
StartSession calls this method on the requests that the session
config’s lottery picks. The default does nothing, for stores that expire data themselves. Read moreAuto Trait Implementations§
impl Forget for MemoryStore
impl Freeze for MemoryStore
impl Move for MemoryStore
impl RefUnwindSafe for MemoryStore
impl Send for MemoryStore
impl Sync for MemoryStore
impl Unpin for MemoryStore
impl UnsafeUnpin for MemoryStorewhere
*const ArcInner<Mutex<HashMap<String, Stored>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Mutex<HashMap<String, Stored>>>>: UnsafeUnpin,
impl UnwindSafe for MemoryStore
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<K> ForeignKey<K> for K
impl<K> ForeignKey<K> for K
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.