pub struct SessionManager { /* private fields */ }Expand description
Session manager for tracking and managing sessions
Implementations§
Source§impl SessionManager
impl SessionManager
Sourcepub fn new(config: SessionTracking, timeout_seconds: u64) -> SessionManager
pub fn new(config: SessionTracking, timeout_seconds: u64) -> SessionManager
Create a new session manager
Sourcepub fn generate_session_id() -> String
pub fn generate_session_id() -> String
Generate a new session ID
Sourcepub async fn get_or_create_session(
&self,
session_id: Option<String>,
) -> Result<String, Error>
pub async fn get_or_create_session( &self, session_id: Option<String>, ) -> Result<String, Error>
Get or create a session
Sourcepub async fn create_session(&self, session_id: String) -> Result<String, Error>
pub async fn create_session(&self, session_id: String) -> Result<String, Error>
Create a new session
Sourcepub async fn get_session(&self, session_id: &str) -> Option<SessionState>
pub async fn get_session(&self, session_id: &str) -> Option<SessionState>
Get a session by ID
Sourcepub async fn update_session(
&self,
session_id: &str,
state: SessionState,
) -> Result<(), Error>
pub async fn update_session( &self, session_id: &str, state: SessionState, ) -> Result<(), Error>
Update a session
Sourcepub async fn list_sessions(&self) -> Vec<String>
pub async fn list_sessions(&self) -> Vec<String>
List all active session IDs
Sourcepub async fn cleanup_expired_sessions(&self) -> usize
pub async fn cleanup_expired_sessions(&self) -> usize
Clean up expired sessions
Sourcepub async fn session_count(&self) -> usize
pub async fn session_count(&self) -> usize
Get the number of active sessions
Sourcepub fn config(&self) -> &SessionTracking
pub fn config(&self) -> &SessionTracking
Get session tracking configuration
Auto Trait Implementations§
impl Freeze for SessionManager
impl !RefUnwindSafe for SessionManager
impl Send for SessionManager
impl Sync for SessionManager
impl Unpin for SessionManager
impl UnsafeUnpin 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more