pub struct SaStorageDistributedStorage { /* private fields */ }Expand description
Persist distributed sessions through SaTokenDao (same serializer and keys as login). 经 SaTokenDao 持久化分布式会话(与登录共用序列化器和键)。
Implementations§
Source§impl SaStorageDistributedStorage
impl SaStorageDistributedStorage
Sourcepub fn from_dao(dao: Arc<SaTokenDao>) -> Self
pub fn from_dao(dao: Arc<SaTokenDao>) -> Self
from_dao — from dao | from_dao
Sourcepub fn from_config(storage: Arc<dyn SaStorage>, config: &SaTokenConfig) -> Self
pub fn from_config(storage: Arc<dyn SaStorage>, config: &SaTokenConfig) -> Self
Compatibility wrapper: builds a Dao from raw storage + prefix. 兼容包装:从原始存储与前缀构造 Dao。
Trait Implementations§
Source§impl Debug for SaStorageDistributedStorage
impl Debug for SaStorageDistributedStorage
Source§impl DistributedSessionStorage for SaStorageDistributedStorage
impl DistributedSessionStorage for SaStorageDistributedStorage
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,
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 Read more
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,
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 Read more
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,
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 Read more
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,
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 Read more
Source§fn save_credential<'life0, 'async_trait>(
&'life0 self,
credential: ServiceCredential,
) -> Pin<Box<dyn Future<Output = Result<(), SaTokenError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn save_credential<'life0, 'async_trait>(
&'life0 self,
credential: ServiceCredential,
) -> Pin<Box<dyn Future<Output = Result<(), SaTokenError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
保存服务凭证 | Save a service credential
用于把 register_service 的凭证持久化到存储
Source§fn get_credential<'life0, 'life1, 'async_trait>(
&'life0 self,
service_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ServiceCredential>, SaTokenError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_credential<'life0, 'life1, 'async_trait>(
&'life0 self,
service_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ServiceCredential>, SaTokenError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
按 service_id 获取服务凭证 | Get a service credential by service_id
未找到返回 Ok(None)
Auto Trait Implementations§
impl !RefUnwindSafe for SaStorageDistributedStorage
impl !UnwindSafe for SaStorageDistributedStorage
impl Freeze for SaStorageDistributedStorage
impl Send for SaStorageDistributedStorage
impl Sync for SaStorageDistributedStorage
impl Unpin for SaStorageDistributedStorage
impl UnsafeUnpin for SaStorageDistributedStorage
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