java.lang.Object
org.tentackle.web.app.WebSessionKeyCache<T>
- Type Parameters:
T- the session key type
A cache mapping user session infos to the web container's session keys.
- Author:
- harald
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSessionInfo(T sessionKey, org.tentackle.session.SessionInfo sessionInfo) Adds a mapping between a session and a session info.
This is usually done in the login controller.org.tentackle.session.SessionInfogetSessionInfo(T sessionKey) Gets the session info.getSessionKeys(org.tentackle.session.SessionInfo sessionInfo) Gets the session keys for a user session info.voidremoveSessionInfo(T sessionKey) Removes a mapping between a session and a session info.
This is usually done in the logout controller.voidstartup(long cleanupInterval) Starts the session key cache.voidTerminates the session cache.
-
Constructor Details
-
WebSessionKeyCache
public WebSessionKeyCache()Creates a session key cache.
-
-
Method Details
-
startup
public void startup(long cleanupInterval) Starts the session key cache.This will start a thread to clean up crashed sessions.
Throws TentackleRuntimeException if the cleanup thread is already running.
- Parameters:
cleanupInterval- interval in [ms] to run cleanup
-
terminate
public void terminate()Terminates the session cache.Throws TentackleRuntimeException if the cleanup thread is not running at all.
-
addSessionInfo
Adds a mapping between a session and a session info.
This is usually done in the login controller. If a session with that key already exists, the session info will be replaced.- Parameters:
sessionKey- the (unique) session keysessionInfo- the user's session info
-
removeSessionInfo
Removes a mapping between a session and a session info.
This is usually done in the logout controller. If there is no such session, the method will do nothing.- Parameters:
sessionKey- the (unique) session key
-
getSessionInfo
Gets the session info.- Parameters:
sessionKey- the session key- Returns:
- the session info, null if no such session info
-
getSessionKeys
Gets the session keys for a user session info.- Parameters:
sessionInfo- the session info- Returns:
- the session keys, never null
-