public class CacheManager extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CACHE_MANAGER_ATTR_NAME |
static String |
DEFAULT_CACHE_CLASSNAME |
static int |
DEFAULT_CACHE_MAX_ENTRIES |
static int |
DEFAULT_CACHE_TIMEOUT |
Constructor and Description |
---|
CacheManager()
default constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addCacheHelperDef(String name,
HashMap<String,String> helperDef)
add a CacheHelper definition
|
void |
addCacheManagerListener(CacheManagerListener listener)
add CacheManagerListener object
|
void |
addCacheMapping(String name,
CacheMapping mapping)
add cache mapping
|
void |
addProperty(String name,
String value)
add generic property
|
Cache |
createCache()
create the designated cache object
|
Cache |
createCache(int cacacity,
String className)
create the designated cache object
|
void |
disable()
enable the cache manager (and all the listeners)
|
void |
enable()
enable the cache manager (and all the listeners)
|
String |
getCacheClassName()
get the underlying cache name
|
CacheHelper |
getCacheHelper(String name)
get the helper by name
|
CacheHelper |
getCacheHelperByFilterName(String filterName)
get the helper by filter name
|
CacheMapping |
getCacheMapping(String name)
get cacheMapping given its name
|
Cache |
getDefaultCache()
get the default application-wide cache
|
int |
getDefaultTimeout()
get the application wide default cache expiry timeout
|
boolean |
isEnabled() |
void |
removeCacheManagerListener(CacheManagerListener listener)
remove CacheManagerListener object
|
void |
setDefaultHelperProps(Map<String,String> map)
set the default-helper's properties
|
void |
setDefaultTimeout(int defaultTimeout)
set the defaultTimeout of this cache
|
void |
setEnabled(boolean enabled)
set the whether this is enabled
|
void |
setMaxEntries(int maxEntries)
set the maximum number of entries of this cache
|
void |
setServletContext(javax.servlet.ServletContext context)
set the ServletContext of this application
|
void |
start()
Start this Context component.
|
void |
stop()
Stop this Context component.
|
public static final String CACHE_MANAGER_ATTR_NAME
public static final int DEFAULT_CACHE_MAX_ENTRIES
public static final int DEFAULT_CACHE_TIMEOUT
public static final String DEFAULT_CACHE_CLASSNAME
public void setMaxEntries(int maxEntries)
maxEntries
- number of entries the cache should carrypublic void setDefaultTimeout(int defaultTimeout)
defaultTimeout
- in secondspublic void setEnabled(boolean enabled)
enabled
- is this enabled?public boolean isEnabled()
public void addProperty(String name, String value)
name
- named propertyvalue
- valuepublic void addCacheHelperDef(String name, HashMap<String,String> helperDef)
name
- CacheHelper namehelperDef
- CacheHelper definitionpublic void setDefaultHelperProps(Map<String,String> map)
map
- a HashMap of propertiespublic void setServletContext(javax.servlet.ServletContext context)
context
- ServletContextpublic void start() throws LifecycleException
LifecycleException
- if a startup error occurspublic String getCacheClassName()
public Cache createCache() throws Exception
Exception
public Cache createCache(int cacacity, String className) throws Exception
Exception
public int getDefaultTimeout()
public Cache getDefaultCache()
public void addCacheMapping(String name, CacheMapping mapping)
name
- unique name of the mappingmapping
- CacheMappingpublic CacheMapping getCacheMapping(String name)
name
- name identifying the mappingpublic CacheHelper getCacheHelper(String name)
name
- name of the cache-helperpublic CacheHelper getCacheHelperByFilterName(String filterName)
filterName
- filter namepublic void addCacheManagerListener(CacheManagerListener listener)
listener
- CacheManagerListener objectpublic void removeCacheManagerListener(CacheManagerListener listener)
listener
- CacheManagerListener objectpublic void enable()
public void disable()
public void stop() throws LifecycleException
LifecycleException
- if a shutdown error occursCopyright © 2019. All rights reserved.