Interface McpSessionStore
Compare-and-set persistence contract for MCP sessions.
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionvoidcreate(@NonNull McpStoredSession session) Persists a newly-created session.voiddeleteBySessionId(@NonNull String sessionId) Deletes a session by ID.findBySessionId(@NonNull String sessionId) Loads a session by ID.static @NonNull McpSessionStoreAcquires the default in-memory session store using Soklet's default idle timeout.static @NonNull McpSessionStorefromInMemory(@NonNull Duration idleTimeout) Acquires the default in-memory session store using a caller-supplied idle timeout.replace(@NonNull McpStoredSession expected, @NonNull McpStoredSession updated) Replaces a session using compare-and-set semantics.
-
Method Details
-
create
Persists a newly-created session.- Parameters:
session- the session to create
-
findBySessionId
Loads a session by ID.- Parameters:
sessionId- the session ID- Returns:
- the stored session, if it exists and has not expired
-
replace
Replaces a session using compare-and-set semantics.- Parameters:
expected- the currently-stored session snapshotupdated- the replacement session snapshot- Returns:
trueif the replacement succeeded
-
deleteBySessionId
Deletes a session by ID.- Parameters:
sessionId- the session ID to delete
-
fromInMemory
Acquires the default in-memory session store using Soklet's default idle timeout.Expired sessions are reclaimed opportunistically during subsequent write activity; exact deletion timing is therefore best-effort rather than timer-driven.
- Returns:
- a new in-memory session store
-
fromInMemory
Acquires the default in-memory session store using a caller-supplied idle timeout.Expired sessions are reclaimed opportunistically during subsequent write activity; exact deletion timing is therefore best-effort rather than timer-driven.
- Parameters:
idleTimeout- the idle timeout, orDuration.ZEROto disable idle expiry- Returns:
- a new in-memory session store
-