Class DefaultSessionCache
- java.lang.Object
-
- com.aspectran.core.component.session.AbstractSessionCache
-
- com.aspectran.core.component.session.DefaultSessionCache
-
- All Implemented Interfaces:
SessionCache
public class DefaultSessionCache extends AbstractSessionCache
Created: 2017. 6. 24.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.aspectran.core.component.session.AbstractSessionCache
AbstractSessionCache.PlaceHolderSession
-
-
Field Summary
-
Fields inherited from class com.aspectran.core.component.session.AbstractSessionCache
evictionPolicy, removeUnloadableSessions, saveOnCreate, saveOnInactiveEviction, sessionDataStore, sessionHandler
-
Fields inherited from interface com.aspectran.core.component.session.SessionCache
EVICT_ON_INACTIVITY, EVICT_ON_SESSION_EXIT, NEVER_EVICT
-
-
Constructor Summary
Constructors Constructor Description DefaultSessionCache(SessionHandler sessionHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Session
doDelete(java.lang.String id)
Remove the session with this identity from the store.Session
doGet(java.lang.String id)
Get the session matching the key.Session
doPutIfAbsent(java.lang.String id, Session session)
Put the session into the map if it wasn't already there.boolean
doReplace(java.lang.String id, Session oldValue, Session newValue)
Replace the mapping from id to oldValue with newValue.long
getSessionsCurrent()
long
getSessionsMax()
long
getSessionsTotal()
Returns a running total of sessions in the cache.Session
newSession(SessionData data)
Create a new Session object from pre-existing session data.void
resetStats()
Resets the running total session count in the cache.-
Methods inherited from class com.aspectran.core.component.session.AbstractSessionCache
checkExpiration, checkInactiveSession, contains, delete, exists, get, getEvictionPolicy, getSessionDataStore, getSessionHandler, isRemoveUnloadableSessions, isSaveOnCreate, isSaveOnInactiveEviction, newSession, put, setEvictionPolicy, setRemoveUnloadableSessions, setSaveOnCreate, setSaveOnInactiveEviction, setSessionDataStore
-
-
-
-
Constructor Detail
-
DefaultSessionCache
public DefaultSessionCache(SessionHandler sessionHandler)
-
-
Method Detail
-
doGet
public Session doGet(java.lang.String id)
Description copied from class:AbstractSessionCache
Get the session matching the key.- Specified by:
doGet
in classAbstractSessionCache
- Parameters:
id
- the session id- Returns:
- the Session object matching the id
-
doPutIfAbsent
public Session doPutIfAbsent(java.lang.String id, Session session)
Description copied from class:AbstractSessionCache
Put the session into the map if it wasn't already there.- Specified by:
doPutIfAbsent
in classAbstractSessionCache
- Parameters:
id
- the identity of the sessionsession
- the session object- Returns:
- null if the session wasn't already in the map, or the existing entry otherwise
-
doDelete
public Session doDelete(java.lang.String id)
Description copied from class:AbstractSessionCache
Remove the session with this identity from the store.- Specified by:
doDelete
in classAbstractSessionCache
- Parameters:
id
- the session id- Returns:
- true if removed; false otherwise
-
doReplace
public boolean doReplace(java.lang.String id, Session oldValue, Session newValue)
Description copied from class:AbstractSessionCache
Replace the mapping from id to oldValue with newValue.- Specified by:
doReplace
in classAbstractSessionCache
- Parameters:
id
- the session idoldValue
- the old valuenewValue
- the new value- Returns:
- true if replacement was done
-
newSession
public Session newSession(SessionData data)
Description copied from class:AbstractSessionCache
Create a new Session object from pre-existing session data.- Specified by:
newSession
in interfaceSessionCache
- Specified by:
newSession
in classAbstractSessionCache
- Parameters:
data
- the session data- Returns:
- a new Session object
-
getSessionsCurrent
public long getSessionsCurrent()
- Returns:
- the number of sessions in the cache
-
getSessionsMax
public long getSessionsMax()
- Returns:
- the max number of sessions in the cache
-
getSessionsTotal
public long getSessionsTotal()
Description copied from interface:SessionCache
Returns a running total of sessions in the cache.- Returns:
- a running total of sessions in the cache
-
resetStats
public void resetStats()
Description copied from interface:SessionCache
Resets the running total session count in the cache.
-
clear
public void clear()
-
-