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 String
CACHE_MANAGER_ATTR_NAME
static String
DEFAULT_CACHE_CLASSNAME
static int
DEFAULT_CACHE_MAX_ENTRIES
static int
DEFAULT_CACHE_TIMEOUT
-
Constructor Summary
Constructors Constructor Description CacheManager()
default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCacheHelperDef(String name, HashMap<String,String> helperDef)
add a CacheHelper definitionvoid
addCacheManagerListener(CacheManagerListener listener)
add CacheManagerListener objectvoid
addCacheMapping(String name, CacheMapping mapping)
add cache mappingvoid
addProperty(String name, String value)
add generic propertyCache
createCache()
create the designated cache objectCache
createCache(int cacacity, String className)
create the designated cache objectvoid
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 nameCacheHelper
getCacheHelper(String name)
get the helper by nameCacheHelper
getCacheHelperByFilterName(String filterName)
get the helper by filter nameCacheMapping
getCacheMapping(String name)
get cacheMapping given its nameCache
getDefaultCache()
get the default application-wide cacheint
getDefaultTimeout()
get the application wide default cache expiry timeoutboolean
isEnabled()
void
removeCacheManagerListener(CacheManagerListener listener)
remove CacheManagerListener objectvoid
setDefaultHelperProps(Map<String,String> map)
set the default-helper's propertiesvoid
setDefaultTimeout(int defaultTimeout)
set the defaultTimeout of this cachevoid
setEnabled(boolean enabled)
set the whether this is enabledvoid
setMaxEntries(int maxEntries)
set the maximum number of entries of this cachevoid
setServletContext(jakarta.servlet.ServletContext context)
set the ServletContext of this applicationvoid
start()
Start this Context component.void
stop()
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 LifecycleException
Start 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 LifecycleException
Stop this Context component. destroy all the caches created and flush/clear the cached content- Throws:
LifecycleException
- if a shutdown error occurs
-
-