pub struct SessionStore { /* private fields */ }Expand description
Thread-safe MCP session store with TTL eviction.
Implementations§
Source§impl SessionStore
impl SessionStore
pub fn new(ttl: Duration) -> Self
Sourcepub fn create(&self) -> Option<String>
pub fn create(&self) -> Option<String>
Create a new session and return its ID, or None if the session cap is
reached even after evicting expired sessions (fail closed).
Sourcepub fn touch(&self, id: &str) -> bool
pub fn touch(&self, id: &str) -> bool
Touch a session (update last_active). Returns false if session doesn’t exist.
Sourcepub fn evict_expired(&self)
pub fn evict_expired(&self)
Evict expired sessions. Call periodically from a background task.
Auto Trait Implementations§
impl !Freeze for SessionStore
impl !RefUnwindSafe for SessionStore
impl Send for SessionStore
impl Sync for SessionStore
impl Unpin for SessionStore
impl UnsafeUnpin for SessionStore
impl UnwindSafe for SessionStore
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request