Interface SessionStore
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
InMemorySessionStore
Storage abstraction for MCP sessions.
-
Method Summary
Modifier and TypeMethodDescriptioncomputeIfAbsent(String sessionId, Function<String, Session> factory) Returns the existing session or creates and stores a new one via the factory.Returns the session for the given ID, if present.@Nullable SessionStores a session, returning any previous session with the same ID.@Nullable SessionRemoves and returns the session for the given ID.default booleanRemoves the session for the given ID only if the stored instance isexpected, returning whether it was removed.values()Returns all stored sessions.Methods inherited from interface java.lang.AutoCloseable
close
-
Method Details
-
put
Stores a session, returning any previous session with the same ID. -
get
Returns the session for the given ID, if present. -
computeIfAbsent
Returns the existing session or creates and stores a new one via the factory. -
values
Collection<Session> values()Returns all stored sessions. -
remove
Removes and returns the session for the given ID. -
remove
Removes the session for the given ID only if the stored instance isexpected, returning whether it was removed. Used by expiry sweeps so a replacement session created under the same ID between the expiry check and the removal is never evicted. This default is check-then-act; implementations backed by an atomic store should override it (seeInMemorySessionStore).
-