|
JSecurity | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jsecurity.cache.ehcache.EhCacheManager
public class EhCacheManager
JSecurity CacheManager implementation utilizing the Ehcache framework for all cache functionality.
This implementation requires EhCache 1.2 and above. Make sure EhCache 1.1 or earlier is not in the classpath or it will not work.
Please see the Ehcache website for their documentation.
| Field Summary | |
|---|---|
static int |
DEFAULT_ACTIVE_SESSIONS_CACHE_MAX_ELEM_IN_MEM
|
static String |
DEFAULT_ACTIVE_SESSIONS_CACHE_NAME
|
static int |
DEFAULT_ACTIVE_SESSIONS_DISK_EXPIRY_THREAD_INTERVAL_SECONDS
|
protected CacheManager |
manager
The EhCache cache manager used by this implementation to create caches. |
| Constructor Summary | |
|---|---|
EhCacheManager()
|
|
| Method Summary | |
|---|---|
void |
destroy()
Shuts-down the wrapped Ehcache CacheManager only if implicitly created. |
Cache |
getCache(String name)
Loads an existing EhCache from the cache manager, or starts a new cache if one is not found. |
CacheManager |
getCacheManager()
Returns the wrapped Ehcache CacheManager instance. |
String |
getCacheManagerConfigFile()
Returns the resource location of the config file used to initialize a new EhCache CacheManager instance. |
protected InputStream |
getCacheManagerConfigFileInputStream()
|
void |
init()
Initializes this instance. |
void |
setCacheManager(CacheManager manager)
Sets the wrapped Ehcache CacheManager instance. |
void |
setCacheManagerConfigFile(String classpathLocation)
Sets the resource location of the config file used to initialize the wrapped EhCache CacheManager instance. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_ACTIVE_SESSIONS_CACHE_NAME
public static final int DEFAULT_ACTIVE_SESSIONS_CACHE_MAX_ELEM_IN_MEM
public static final int DEFAULT_ACTIVE_SESSIONS_DISK_EXPIRY_THREAD_INTERVAL_SECONDS
protected CacheManager manager
| Constructor Detail |
|---|
public EhCacheManager()
| Method Detail |
|---|
public CacheManager getCacheManager()
CacheManager instance.
CacheManager instance.public void setCacheManager(CacheManager manager)
CacheManager instance.
manager - the wrapped Ehcache CacheManager instance.public String getCacheManagerConfigFile()
ResourceUtils.getInputStreamForPath(String) call.
This property is ignored if the CacheManager instance is injected directly - that is, it is only used to lazily create a CacheManager if one is not already provided.
public void setCacheManagerConfigFile(String classpathLocation)
ResourceUtils.getInputStreamForPath(String) call.
This property is ignored if the CacheManager instance is injected directly - that is, it is only used to lazily create a CacheManager if one is not already provided.
classpathLocation - resource location of the config file used to create the wrapped
EhCache CacheManager instance.protected InputStream getCacheManagerConfigFileInputStream()
public final Cache getCache(String name)
throws CacheException
getCache in interface CacheManagername - the name of the cache to load/create.
CacheException - if there is an error acquiring the Cache instance.
public final void init()
throws CacheException
If a CacheManager has been
explicitly set (e.g. via Dependency Injection or programatically) prior to calling this
method, this method does nothing.
However, if no CacheManager has been set, the default Ehcache singleton will be initialized, where Ehcache will look for an ehcache.xml file at the root of the classpath. If one is not found, Ehcache will use its own failsafe configuration file.
Because JSecurity cannot use the failsafe defaults (failsafe expunges cached objects after 2 minutes, something not desireable for JSecurity sessions), this class manages an internal default configuration for this case.
init in interface InitializableCacheException - if there are any CacheExceptions thrown by EhCache.CacheManager.create()public void destroy()
If another component injected
a non-null CacheManager into this instace before calling init, this instance expects that same
component to also destroy the CacheManager instance, and it will not attempt to do so.
destroy in interface Destroyable
|
JSecurity | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||