pub trait SessionStore: Send + Sync {
// Required methods
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = Option<Arc<Mutex<TxServer>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn set<'life0, 'async_trait>(
&'life0 self,
key: SessionId,
value: TxServer,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn keys<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<SessionId>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn values<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<Arc<Mutex<DuplexStream>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
Trait defining the interface for session storage operations
This trait provides asynchronous methods for managing session data, Implementors must be Send and Sync to support concurrent access.
Required Methods§
Sourcefn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = Option<Arc<Mutex<TxServer>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = Option<Arc<Mutex<TxServer>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn set<'life0, 'async_trait>(
&'life0 self,
key: SessionId,
value: TxServer,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set<'life0, 'async_trait>(
&'life0 self,
key: SessionId,
value: TxServer,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stores a new session with the given identifier
§Arguments
key
- The session identifiervalue
- The duplex stream to store
Sourcefn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Clears all sessions from the store
fn keys<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<SessionId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn values<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<Arc<Mutex<DuplexStream>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Implementors§
impl SessionStore for InMemorySessionStore
Implementation of the SessionStore trait for InMemorySessionStore
Provides asynchronous methods for managing sessions in memory, ensuring thread-safety through read-write locks and mutexes.