Skip to main content

SessionStore

Trait SessionStore 

Source
pub trait SessionStore:
    Send
    + Sync
    + 'static {
    // Required methods
    fn create(&self, id: &str) -> impl Future<Output = SessionInfo> + Send;
    fn get(&self, id: &str) -> impl Future<Output = Option<SessionInfo>> + Send;
    fn touch(&self, id: &str) -> impl Future<Output = ()> + Send;
    fn update_state(
        &self,
        id: &str,
        state: SessionState,
    ) -> impl Future<Output = ()> + Send;
    fn set_client_info(
        &self,
        id: &str,
        info: ClientInfo,
    ) -> impl Future<Output = ()> + Send;
    fn remove(&self, id: &str) -> impl Future<Output = ()> + Send;
    fn list(&self) -> impl Future<Output = Vec<SessionInfo>> + Send;
}
Expand description

Trait for session storage backends. Async to support I/O-backed stores (Redis, database, logging).

Required Methods§

Source

fn create(&self, id: &str) -> impl Future<Output = SessionInfo> + Send

Source

fn get(&self, id: &str) -> impl Future<Output = Option<SessionInfo>> + Send

Source

fn touch(&self, id: &str) -> impl Future<Output = ()> + Send

Source

fn update_state( &self, id: &str, state: SessionState, ) -> impl Future<Output = ()> + Send

Source

fn set_client_info( &self, id: &str, info: ClientInfo, ) -> impl Future<Output = ()> + Send

Source

fn remove(&self, id: &str) -> impl Future<Output = ()> + Send

Source

fn list(&self) -> impl Future<Output = Vec<SessionInfo>> + Send

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§