Struct gotham::middleware::session::MemoryBackend
source · pub struct MemoryBackend { /* private fields */ }
Expand description
Defines the in-process memory based session storage.
This is the default implementation which is used by NewSessionMiddleware::default()
Implementations§
source§impl MemoryBackend
impl MemoryBackend
sourcepub fn new(ttl: Duration) -> MemoryBackend
pub fn new(ttl: Duration) -> MemoryBackend
Creates a new MemoryBackend
where sessions expire and are removed after the ttl
has
elapsed.
Alternately, MemoryBackend::default()
creates a MemoryBackend
with a ttl
of one hour.
§Examples
NewSessionMiddleware::new(MemoryBackend::new(Duration::from_secs(3600)))
Trait Implementations§
source§impl Backend for MemoryBackend
impl Backend for MemoryBackend
source§fn persist_session(
&self,
_: &State,
identifier: SessionIdentifier,
content: &[u8]
) -> Pin<Box<SetSessionFuture>>
fn persist_session( &self, _: &State, identifier: SessionIdentifier, content: &[u8] ) -> Pin<Box<SetSessionFuture>>
Persists a session, either creating a new session or updating an existing session.
source§fn read_session(
&self,
_: &State,
identifier: SessionIdentifier
) -> Pin<Box<GetSessionFuture>>
fn read_session( &self, _: &State, identifier: SessionIdentifier ) -> Pin<Box<GetSessionFuture>>
Retrieves a session from the underlying storage. Read more
source§fn drop_session(
&self,
_: &State,
identifier: SessionIdentifier
) -> Pin<Box<SetSessionFuture>>
fn drop_session( &self, _: &State, identifier: SessionIdentifier ) -> Pin<Box<SetSessionFuture>>
Drops a session from the underlying storage.
source§impl Clone for MemoryBackend
impl Clone for MemoryBackend
source§fn clone(&self) -> MemoryBackend
fn clone(&self) -> MemoryBackend
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Default for MemoryBackend
impl Default for MemoryBackend
source§fn default() -> MemoryBackend
fn default() -> MemoryBackend
Returns the “default value” for a type. Read more
source§impl NewBackend for MemoryBackend
impl NewBackend for MemoryBackend
§type Instance = MemoryBackend
type Instance = MemoryBackend
The type of
Backend
created by the NewBackend
.source§fn new_backend(&self) -> Result<Self::Instance>
fn new_backend(&self) -> Result<Self::Instance>
Create and return a new
Backend
value.Auto Trait Implementations§
impl Freeze for MemoryBackend
impl RefUnwindSafe for MemoryBackend
impl Send for MemoryBackend
impl Sync for MemoryBackend
impl Unpin for MemoryBackend
impl UnwindSafe for MemoryBackend
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