T - the session key typepublic class WebSessionKeyCache<T> extends Object
| Constructor and Description |
|---|
WebSessionKeyCache()
Creates a session key cache.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSession(T sessionKey,
org.tentackle.session.SessionInfo sessionInfo)
Adds a mapping between a session and a user info.
This is usually done in the login controller. |
org.tentackle.session.SessionInfo |
getSession(T sessionKey)
Gets the session.
|
Collection<T> |
getSessionKeys(org.tentackle.session.SessionInfo sessionInfo)
Gets the session keys for a user session info.
|
void |
removeSession(T sessionKey)
Removes a mapping between a session and a user info.
This is usually done in the logout controller. |
void |
startup(long cleanupInterval)
Starts the session key cache.
|
void |
terminate()
Terminates the session cache.
|
public void startup(long cleanupInterval)
throws org.tentackle.misc.ApplicationException
This will start a thread to cleanup crashed sessions.
cleanupInterval - interval in [ms] to run cleanuporg.tentackle.misc.ApplicationException - if the cleanup thread is already runningpublic void terminate()
throws org.tentackle.misc.ApplicationException
org.tentackle.misc.ApplicationException - if the cleanup thread is not running at allpublic void addSession(T sessionKey, org.tentackle.session.SessionInfo sessionInfo)
sessionKey - the (unique) session keysessionInfo - the user's session infopublic void removeSession(T sessionKey)
sessionKey - the (unique) session keypublic org.tentackle.session.SessionInfo getSession(T sessionKey)
sessionKey - the session keypublic Collection<T> getSessionKeys(org.tentackle.session.SessionInfo sessionInfo)
sessionInfo - the user infoTentackle - distributed, domain- and model-driven