Class CacheManager


  • public class CacheManager
    extends Object
    • Constructor Detail

      • CacheManager

        public CacheManager()
        default constructor
    • 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 property
        value - value
      • addCacheHelperDef

        public void addCacheHelperDef​(String name,
                                      HashMap<String,​String> helperDef)
        add a CacheHelper definition
        Parameters:
        name - CacheHelper name
        helperDef - 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
      • 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 mapping
        mapping - 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