public class SessionCache extends Object
Primarily used in web-applications where short-lived roundtrips must be associated to long-lived authenticated sessions.
| Constructor and Description |
|---|
SessionCache()
Creates a session cache.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSession(Object sessionKey,
SessionInfo userInfo)
Adds a mapping between a session and a user info.
This is usually done in the login controller. |
SessionInfo |
getSession(Object sessionKey)
Gets the session.
|
void |
removeSession(Object 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 cache.
|
void |
terminate()
Terminates the session cache.
|
public void startup(long cleanupInterval)
throws ApplicationException
This will start a thread to cleanup crashed sessions.
cleanupInterval - interval in [ms] to run cleanupApplicationException - if the cleanup thread is already runningpublic void terminate()
throws ApplicationException
ApplicationException - if the cleanup thread is not running at allpublic void addSession(Object sessionKey, SessionInfo userInfo)
sessionKey - the (unique) session keyuserInfo - the user infopublic void removeSession(Object sessionKey)
sessionKey - the (unique) session keypublic SessionInfo getSession(Object sessionKey)
sessionKey - the session keyCopyright © 2016 Krake Softwaretechnik. All rights reserved.