public class EnterpriseCacheSessionDAO extends CachingSessionDAO
Cache
or
CacheManager
is backed by an enterprise caching product that can support
all application sessions and/or provide disk paging for resilient data storage.
CacheManager
, which is great for testing but
will typically not scale for production environments and could easily cause OutOfMemoryException
s. Just
don't forget to configure* an instance of this class with a production-grade CacheManager
that can
handle disk paging for large numbers of sessions and you'll be fine.
*If you configure Shiro's SecurityManager
instance with such a CacheManager
, it will be
automatically applied to an instance of this class and you won't need to explicitly set it in configuration.
parent class
's transparent caching behavior for
all storage operations with the enterprise caching product. Because the parent class uses a Cache
or
CacheManager
to perform caching, and the cache is considered the system of record, nothing further needs to
be done for the doReadSession(java.io.Serializable)
, doUpdate(org.apache.shiro.session.Session)
and doDelete(org.apache.shiro.session.Session)
method implementations. This class
implements those methods as required by the parent class, but they essentially do nothing.ACTIVE_SESSION_CACHE_NAME
Constructor and Description |
---|
EnterpriseCacheSessionDAO() |
Modifier and Type | Method and Description |
---|---|
protected Serializable |
doCreate(Session session)
Subclass hook to actually persist the given Session instance to the underlying EIS.
|
protected void |
doDelete(Session session)
Subclass implementation hook to permanently delete the given Session from the underlying EIS.
|
protected Session |
doReadSession(Serializable sessionId)
Subclass implementation hook that retrieves the Session object from the underlying EIS or
null if a
session with that ID could not be found. |
protected void |
doUpdate(Session session)
Subclass implementation hook to actually persist the
Session 's state to the underlying EIS. |
cache, cache, create, createActiveSessionsCache, delete, getActiveSessions, getActiveSessionsCache, getActiveSessionsCacheName, getCachedSession, getCachedSession, getCacheManager, readSession, setActiveSessionsCache, setActiveSessionsCacheName, setCacheManager, uncache, update
assignSessionId, generateSessionId, getSessionIdGenerator, setSessionIdGenerator
public EnterpriseCacheSessionDAO()
protected Serializable doCreate(Session session)
AbstractSessionDAO
doCreate
in class AbstractSessionDAO
session
- the Session instance to persist to the EIS.Session.getId()
.protected Session doReadSession(Serializable sessionId)
AbstractSessionDAO
null
if a
session with that ID could not be found.doReadSession
in class AbstractSessionDAO
sessionId
- the id of the Session to retrieve.null
if a
session with that ID could not be found.protected void doUpdate(Session session)
CachingSessionDAO
Session
's state to the underlying EIS.doUpdate
in class CachingSessionDAO
session
- the session object whose state will be propagated to the EIS.protected void doDelete(Session session)
CachingSessionDAO
doDelete
in class CachingSessionDAO
session
- the session instance to permanently delete from the EIS.Copyright © 2004-2016 The Apache Software Foundation. All Rights Reserved.