Package com.sun.appserv.web.cache
Class CacheManager
- java.lang.Object
-
- com.sun.appserv.web.cache.CacheManager
-
public class CacheManager extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringCACHE_MANAGER_ATTR_NAMEstatic StringDEFAULT_CACHE_CLASSNAMEstatic intDEFAULT_CACHE_MAX_ENTRIESstatic intDEFAULT_CACHE_TIMEOUT
-
Constructor Summary
Constructors Constructor Description CacheManager()default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCacheHelperDef(String name, HashMap<String,String> helperDef)add a CacheHelper definitionvoidaddCacheManagerListener(CacheManagerListener listener)add CacheManagerListener objectvoidaddCacheMapping(String name, CacheMapping mapping)add cache mappingvoidaddProperty(String name, String value)add generic propertyCachecreateCache()create the designated cache objectCachecreateCache(int cacacity, String className)create the designated cache objectvoiddisable()enable the cache manager (and all the listeners)voidenable()enable the cache manager (and all the listeners)StringgetCacheClassName()get the underlying cache nameCacheHelpergetCacheHelper(String name)get the helper by nameCacheHelpergetCacheHelperByFilterName(String filterName)get the helper by filter nameCacheMappinggetCacheMapping(String name)get cacheMapping given its nameCachegetDefaultCache()get the default application-wide cacheintgetDefaultTimeout()get the application wide default cache expiry timeoutbooleanisEnabled()voidremoveCacheManagerListener(CacheManagerListener listener)remove CacheManagerListener objectvoidsetDefaultHelperProps(Map<String,String> map)set the default-helper's propertiesvoidsetDefaultTimeout(int defaultTimeout)set the defaultTimeout of this cachevoidsetEnabled(boolean enabled)set the whether this is enabledvoidsetMaxEntries(int maxEntries)set the maximum number of entries of this cachevoidsetServletContext(jakarta.servlet.ServletContext context)set the ServletContext of this applicationvoidstart()Start this Context component.voidstop()Stop this Context component.
-
-
-
Field Detail
-
CACHE_MANAGER_ATTR_NAME
public static final String CACHE_MANAGER_ATTR_NAME
- See Also:
- Constant Field Values
-
DEFAULT_CACHE_MAX_ENTRIES
public static final int DEFAULT_CACHE_MAX_ENTRIES
- See Also:
- Constant Field Values
-
DEFAULT_CACHE_TIMEOUT
public static final int DEFAULT_CACHE_TIMEOUT
- See Also:
- Constant Field Values
-
DEFAULT_CACHE_CLASSNAME
public static final String DEFAULT_CACHE_CLASSNAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
setMaxEntries
public void setMaxEntries(int maxEntries)
set the maximum number of entries of this cache- Parameters:
maxEntries- number of entries the cache should carry
-
setDefaultTimeout
public void setDefaultTimeout(int defaultTimeout)
set the defaultTimeout of this cache- Parameters:
defaultTimeout- in seconds
-
setEnabled
public void setEnabled(boolean enabled)
set the whether this is enabled- Parameters:
enabled- is this enabled?
-
isEnabled
public boolean isEnabled()
- Returns:
- whether this is enabled
-
addProperty
public void addProperty(String name, String value)
add generic property- Parameters:
name- named propertyvalue- value
-
addCacheHelperDef
public void addCacheHelperDef(String name, HashMap<String,String> helperDef)
add a CacheHelper definition- Parameters:
name- CacheHelper namehelperDef- CacheHelper definition
-
setDefaultHelperProps
public void setDefaultHelperProps(Map<String,String> map)
set the default-helper's properties- Parameters:
map- a HashMap of properties
-
setServletContext
public void setServletContext(jakarta.servlet.ServletContext context)
set the ServletContext of this application- Parameters:
context- ServletContext
-
start
public void start() throws LifecycleExceptionStart this Context component.- Throws:
LifecycleException- if a startup error occurs
-
getCacheClassName
public String getCacheClassName()
get the underlying cache name- Returns:
- the cacheClassName
-
createCache
public Cache createCache() throws Exception
create the designated cache object- Returns:
- the Cache implementation
- Throws:
Exception
-
createCache
public Cache createCache(int cacacity, String className) throws Exception
create the designated cache object- Returns:
- the Cache implementation
- Throws:
Exception
-
getDefaultTimeout
public int getDefaultTimeout()
get the application wide default cache expiry timeout- Returns:
- timeout in seconds
-
getDefaultCache
public Cache getDefaultCache()
get the default application-wide cache- Returns:
- cache object
-
addCacheMapping
public void addCacheMapping(String name, CacheMapping mapping)
add cache mapping- Parameters:
name- unique name of the mappingmapping- CacheMapping
-
getCacheMapping
public CacheMapping getCacheMapping(String name)
get cacheMapping given its name- Parameters:
name- name identifying the mapping- Returns:
- CacheMapping
-
getCacheHelper
public CacheHelper getCacheHelper(String name)
get the helper by name- Parameters:
name- name of the cache-helper- Returns:
- CacheHelper implementation
-
getCacheHelperByFilterName
public CacheHelper getCacheHelperByFilterName(String filterName)
get the helper by filter name- Parameters:
filterName- filter name- Returns:
- CacheHelper implementation
-
addCacheManagerListener
public void addCacheManagerListener(CacheManagerListener listener)
add CacheManagerListener object- Parameters:
listener- CacheManagerListener object
-
removeCacheManagerListener
public void removeCacheManagerListener(CacheManagerListener listener)
remove CacheManagerListener object- Parameters:
listener- CacheManagerListener object
-
enable
public void enable()
enable the cache manager (and all the listeners)
-
disable
public void disable()
enable the cache manager (and all the listeners)
-
stop
public void stop() throws LifecycleExceptionStop this Context component. destroy all the caches created and flush/clear the cached content- Throws:
LifecycleException- if a shutdown error occurs
-
-