DistributedSessionStorage

Trait DistributedSessionStorage 

Source
pub trait DistributedSessionStorage: Send + Sync {
    // Required methods
    fn save_session<'life0, 'async_trait>(
        &'life0 self,
        session: DistributedSession,
        ttl: Option<Duration>,
    ) -> Pin<Box<dyn Future<Output = Result<(), SaTokenError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_session<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<DistributedSession>, SaTokenError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_session<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), SaTokenError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_sessions_by_login_id<'life0, 'life1, 'async_trait>(
        &'life0 self,
        login_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<DistributedSession>, SaTokenError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Distributed session storage trait 分布式 Session 存储 trait

Implement this trait to provide custom storage backends 实现此 trait 以提供自定义存储后端

Required Methods§

Source

fn save_session<'life0, 'async_trait>( &'life0 self, session: DistributedSession, ttl: Option<Duration>, ) -> Pin<Box<dyn Future<Output = Result<(), SaTokenError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Save a session to storage with optional TTL 保存 Session 到存储,可选 TTL

§Arguments | 参数
  • session - Session to save | 要保存的 Session
  • ttl - Time-to-live duration | 生存时间
Source

fn get_session<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<DistributedSession>, SaTokenError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a session from storage 从存储获取 Session

§Arguments | 参数
  • session_id - Session identifier | Session 标识符
Source

fn delete_session<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), SaTokenError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a session from storage 从存储删除 Session

§Arguments | 参数
  • session_id - Session identifier | Session 标识符
Source

fn get_sessions_by_login_id<'life0, 'life1, 'async_trait>( &'life0 self, login_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<DistributedSession>, SaTokenError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get all sessions for a specific user 获取特定用户的所有 Sessions

§Arguments | 参数
  • login_id - User login ID | 用户登录 ID

Implementors§