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 voidclear()SessiondoDelete(java.lang.String id)Remove the session with this identity from the store.SessiondoGet(java.lang.String id)Get the session matching the key.SessiondoPutIfAbsent(java.lang.String id, Session session)Put the session into the map if it wasn't already there.booleandoReplace(java.lang.String id, Session oldValue, Session newValue)Replace the mapping from id to oldValue with newValue.longgetSessionsCurrent()longgetSessionsMax()longgetSessionsTotal()Returns a running total of sessions in the cache.SessionnewSession(SessionData data)Create a new Session object from pre-existing session data.voidresetStats()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:AbstractSessionCacheGet the session matching the key.- Specified by:
doGetin 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:AbstractSessionCachePut the session into the map if it wasn't already there.- Specified by:
doPutIfAbsentin 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:AbstractSessionCacheRemove the session with this identity from the store.- Specified by:
doDeletein 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:AbstractSessionCacheReplace the mapping from id to oldValue with newValue.- Specified by:
doReplacein 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:AbstractSessionCacheCreate a new Session object from pre-existing session data.- Specified by:
newSessionin interfaceSessionCache- Specified by:
newSessionin 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:SessionCacheReturns 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:SessionCacheResets the running total session count in the cache.
-
clear
public void clear()
-
-