Class InMemorySessionStore
java.lang.Object
dev.tachyonmcp.core.server.session.InMemorySessionStore
- All Implemented Interfaces:
SessionStore,AutoCloseable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()computeIfAbsent(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.booleanRemoves the session for the given ID only if the stored instance isexpected, returning whether it was removed.values()Returns all stored sessions.
-
Constructor Details
-
InMemorySessionStore
public InMemorySessionStore()
-
-
Method Details
-
put
Description copied from interface:SessionStoreStores a session, returning any previous session with the same ID.- Specified by:
putin interfaceSessionStore
-
get
Description copied from interface:SessionStoreReturns the session for the given ID, if present.- Specified by:
getin interfaceSessionStore
-
computeIfAbsent
Description copied from interface:SessionStoreReturns the existing session or creates and stores a new one via the factory.- Specified by:
computeIfAbsentin interfaceSessionStore
-
values
Description copied from interface:SessionStoreReturns all stored sessions.- Specified by:
valuesin interfaceSessionStore
-
remove
Description copied from interface:SessionStoreRemoves and returns the session for the given ID.- Specified by:
removein interfaceSessionStore
-
remove
Description copied from interface:SessionStoreRemoves 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).- Specified by:
removein interfaceSessionStore
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-