pub struct FileSessionStorage { /* private fields */ }Expand description
A Session storage that stores each session, JSON encoded, on the local disk.
In production, you may want to put this behind a MemoryStore
for performance.
Implementations§
Source§impl FileSessionStorage
impl FileSessionStorage
Sourcepub fn new() -> FileSessionStorage
pub fn new() -> FileSessionStorage
Create a new `FileSessionStore`` in the folder “.sessions”
Sourcepub fn new_in_folder(folder: impl Into<Cow<'static, Path>>) -> Self
pub fn new_in_folder(folder: impl Into<Cow<'static, Path>>) -> Self
Create a new FileSessionStore with sessions placed in the given folder.
Sourcepub fn set_minimum_expiry_date(self, duration: Duration) -> Self
pub fn set_minimum_expiry_date(self, duration: Duration) -> Self
We need to open every session file to determine if it expired. The minimum expiry time sets the minimum age of a file before attempting to open it.
Trait Implementations§
Source§impl Clone for FileSessionStorage
impl Clone for FileSessionStorage
Source§fn clone(&self) -> FileSessionStorage
fn clone(&self) -> FileSessionStorage
Returns a duplicate 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 Debug for FileSessionStorage
impl Debug for FileSessionStorage
Source§impl Default for FileSessionStorage
impl Default for FileSessionStorage
Source§impl ExpiredDeletion for FileSessionStorage
impl ExpiredDeletion for FileSessionStorage
Source§fn delete_expired<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_expired<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
A method for deleting expired sessions from the store.
Source§fn continuously_delete_expired<'async_trait>(
self,
period: Duration,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
fn continuously_delete_expired<'async_trait>(
self,
period: Duration,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
This function will keep running indefinitely, deleting expired rows and
then waiting for the specified period before deleting again. Read more
Source§impl PartialEq for FileSessionStorage
impl PartialEq for FileSessionStorage
Source§impl SessionStore for FileSessionStorage
impl SessionStore for FileSessionStorage
Source§fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 mut Record,
) -> 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 Record,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Creates a new session in the store with the provided session record. Read more
Source§fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 Record,
) -> 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 Record,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Saves the provided session record to the store. Read more
Source§fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 Id,
) -> Pin<Box<dyn Future<Output = Result<Option<Record>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 Id,
) -> Pin<Box<dyn Future<Output = Result<Option<Record>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Loads an existing session record from the store using the provided ID. Read more
impl Eq for FileSessionStorage
impl StructuralPartialEq for FileSessionStorage
Auto Trait Implementations§
impl Freeze for FileSessionStorage
impl RefUnwindSafe for FileSessionStorage
impl Send for FileSessionStorage
impl Sync for FileSessionStorage
impl Unpin for FileSessionStorage
impl UnwindSafe for FileSessionStorage
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