pub trait SessionManager {
type Error: Debug + Display;
// Required methods
fn set<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
id: &'life1 str,
key: &'life2 str,
val: &'life3 str,
time: Duration,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn expire_in<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
key: &'life2 str,
time: Duration,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn clear_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
Represents a handle to the underlying data structure
managing sessions in a Rocket application.
The id
parameter corresponds to the session token
stored by the client. This should correspond to a
random alphanumeric string of letters with sufficient entropy.
The key
and value
parameters can be used to set custom fields. They could
be used to store CRSF tokens, timestamps or some other session metadata.