pub struct FileStore { /* private fields */ }Expand description
One JSON file per session, under storage/sessions by default.
Survives a restart, needs no service to be running, and is what a single application server should use. It does not work across machines: two nodes behind a load balancer each keep their own directory, and a visitor bounced between them looks logged out on alternate requests.
Implementations§
Trait Implementations§
Source§impl SessionStore for FileStore
impl SessionStore for FileStore
Source§fn 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.Source§fn 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.
Source§fn 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.
Auto Trait Implementations§
impl Freeze for FileStore
impl RefUnwindSafe for FileStore
impl Send for FileStore
impl Sync for FileStore
impl Unpin for FileStore
impl UnsafeUnpin for FileStore
impl UnwindSafe for FileStore
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