pub struct SessionManager;Implementations§
Source§impl SessionManager
impl SessionManager
Sourcepub async fn create_session(session_id: String, timestamp: u64)
pub async fn create_session(session_id: String, timestamp: u64)
Creates a new session with the given session ID and timestamp.
Sourcepub async fn get_session(session_id: &str) -> Option<SessionState>
pub async fn get_session(session_id: &str) -> Option<SessionState>
Retrieves a copy of the session state for the given session ID. Returns None if the session does not exist.
Sourcepub async fn update_session(session_id: &str, timestamp: u64) -> bool
pub async fn update_session(session_id: &str, timestamp: u64) -> bool
Updates the last seen timestamp of the session identified by session_id. Returns true if the session was found and updated.
Sourcepub async fn remove_session(session_id: &str) -> bool
pub async fn remove_session(session_id: &str) -> bool
Removes the session identified by session_id. Returns true if a session was removed.
Sourcepub async fn purge_stale_sessions(threshold: u64)
pub async fn purge_stale_sessions(threshold: u64)
Purges sessions that have not been updated since the provided threshold. For example, pass in a timestamp and any session with last_seen less than that value will be removed.
Sourcepub async fn list_sessions() -> Vec<String>
pub async fn list_sessions() -> Vec<String>
Returns a list of active session IDs.
Auto Trait Implementations§
impl Freeze for SessionManager
impl RefUnwindSafe for SessionManager
impl Send for SessionManager
impl Sync for SessionManager
impl Unpin for SessionManager
impl UnwindSafe for SessionManager
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