pub struct StandardSessionManager { /* private fields */ }Expand description
标准会话管理器(内存实现)。
对应 Java StandardSessionManager:维护 sessionId → 会话的映射,
支持 getSession(id) 与 getSession(id, create) 语义。
同一 sessionId 返回同一会话对象(Arc 共享,对应 Java 引用同一性)。
Implementations§
Source§impl StandardSessionManager
impl StandardSessionManager
Sourcepub fn with_max_inactive(max_inactive_interval: Duration) -> Self
pub fn with_max_inactive(max_inactive_interval: Duration) -> Self
Sourcepub fn active_sessions(&self) -> usize
pub fn active_sessions(&self) -> usize
返回当前活跃会话数(未失效会话)。
对应 Java InternalSessionManager.getActiveSessions。
Sourcepub fn expire_inactive_sessions(&self)
pub fn expire_inactive_sessions(&self)
清理超过最长不活动时间的会话。
对应 Java StandardSessionManager 后台处理器(backgroundProcessorDelay)
的清理动作;Rust 以显式调用表达(ADAPTED:无后台线程)。
Sourcepub fn end_access(&self, session_id: &str)
pub fn end_access(&self, session_id: &str)
标记会话访问结束(对应 Java InternalSession.endAccess)。
更新会话的最后访问时间,使不活动计时从此刻重新开始。
Sourcepub fn max_inactive_interval(&self) -> Duration
pub fn max_inactive_interval(&self) -> Duration
返回最长不活动时间(测试断言用)。
Trait Implementations§
Source§impl Debug for StandardSessionManager
impl Debug for StandardSessionManager
Source§impl Default for StandardSessionManager
impl Default for StandardSessionManager
Source§fn default() -> StandardSessionManager
fn default() -> StandardSessionManager
Returns the “default value” for a type. Read more
Source§impl WxSessionManager for StandardSessionManager
impl WxSessionManager for StandardSessionManager
Source§fn get_session(&self, session_id: &str) -> Arc<dyn WxSession> ⓘ
fn get_session(&self, session_id: &str) -> Arc<dyn WxSession> ⓘ
获取某个 sessionId 对应的 session;如果不存在则新建一个并返回。 Read more
Source§fn get_session_or_create(
&self,
session_id: &str,
create: bool,
) -> Option<Arc<dyn WxSession>>
fn get_session_or_create( &self, session_id: &str, create: bool, ) -> Option<Arc<dyn WxSession>>
获取某个 sessionId 对应的 session。 Read more
Source§fn end_access(&self, _session_id: &str)
fn end_access(&self, _session_id: &str)
标记会话访问结束(对应 Java
InternalSession.endAccess)。 Read moreAuto Trait Implementations§
impl !Freeze for StandardSessionManager
impl RefUnwindSafe for StandardSessionManager
impl Send for StandardSessionManager
impl Sync for StandardSessionManager
impl Unpin for StandardSessionManager
impl UnsafeUnpin for StandardSessionManager
impl UnwindSafe for StandardSessionManager
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