Class EhcacheController

java.lang.Object
edu.internet2.middleware.grouper.cache.EhcacheController
All Implemented Interfaces:
CacheController

public class EhcacheController extends Object implements CacheController
Base class for common cache operations.
Since:
1.2.1
Version:
$Id: EhcacheController.java,v 1.13 2009-08-11 20:34:18 mchyzer Exp $
  • Method Details

    • getconfiguration

      public net.sf.ehcache.config.Configuration getconfiguration()
      save the config
      Returns:
      the configuration
    • isConfiguredViaProperties

      public boolean isConfiguredViaProperties()
      if configured via properties and not ehcache.xml
      Returns:
      the configuredViaProperties
    • getCacheManager

      public net.sf.ehcache.CacheManager getCacheManager()
      get the mgr
      Returns:
      the mge
    • ehcacheController

      public static EhcacheController ehcacheController()
      utility cache controller if you dont want to create your own...
      Returns:
      ehcache controller
    • finalize

      protected void finalize() throws Throwable
      Overrides:
      finalize in class Object
      Throws:
      Throwable
      See Also:
    • stop

      public void stop()
      See Also:
    • flushCache

      public void flushCache()
      Flush all caches.
      Specified by:
      flushCache in interface CacheController
      Since:
      1.2.1
    • getGrouperCache

      public GrouperCache getGrouperCache(String name) throws IllegalStateException
      Retrieve a grouper cache (like a generic Map)
      Parameters:
      name - should be unique, prefix with fully qualified classname
      Returns:
      Cache name.
      Throws:
      IllegalStateException - if cache not found.
      Since:
      1.2.1
    • getGrouperCache

      public GrouperCache getGrouperCache(String name, boolean useDefaultIfNotInConfigFile, int defaultMaxElementsInMemory, boolean defaultEternal, int defaultTimeToIdleSeconds, int defaultTimeToLiveSeconds, boolean defaultOverflowToDisk) throws IllegalStateException
      Retrieve a GrouperCache which is a generic Map cache. Note the defaults are only used in the first invocation of the cache retrieval.
      Parameters:
      name - should be unique, prefix with fully qualified classname
      useDefaultIfNotInConfigFile - use the defaults if not in the config file
      defaultMaxElementsInMemory - if not in config file, this is max elements in memory
      defaultEternal - if not in config file, true to never expire stuff
      defaultTimeToIdleSeconds - if not in config file, time where if not accessed, will expire
      defaultTimeToLiveSeconds - if not in config file, time where even if accessed, will expire
      defaultOverflowToDisk - if not in config file, if it should go to disk in overflow
      Returns:
      Cache name.
      Throws:
      IllegalStateException - if cache not found.
      Since:
      1.2.1
    • getCache

      public net.sf.ehcache.Cache getCache(String name) throws IllegalStateException
      Note, this might be better to be used from GrouperCache
      Parameters:
      name - should be unique, prefix with fully qualified classname
      Returns:
      Cache name.
      Throws:
      IllegalStateException - if cache not found.
      Since:
      1.2.1
    • getCache

      public net.sf.ehcache.Cache getCache(String name, boolean useDefaultIfNotInConfigFile, int defaultMaxElementsInMemory, boolean defaultEternal, int defaultTimeToIdleSeconds, int defaultTimeToLiveSeconds, boolean defaultOverflowToDisk) throws IllegalStateException
      Note, this might be better to be used from GrouperCache
      Parameters:
      name - should be unique, prefix with fully qualified classname
      useDefaultIfNotInConfigFile - use the defaults if not in the config file
      defaultMaxElementsInMemory - if not in config file, this is max elements in memory
      defaultEternal - if not in config file, true to never expire stuff
      defaultTimeToIdleSeconds - if not in config file, time where if not accessed, will expire
      defaultTimeToLiveSeconds - if not in config file, time where even if accessed, will expire
      defaultOverflowToDisk - if not in config file, if it should go to disk in overflow
      Returns:
      Cache name.
      Throws:
      IllegalStateException - if cache not found.
      Since:
      1.2.1
    • initialize

      public void initialize()
      Initialize privilege cache.
      Specified by:
      initialize in interface CacheController
      Since:
      1.2.1
    • getStats

      public CacheStats getStats(String cache)
      Specified by:
      getStats in interface CacheController
      Returns:
      ehcache statistics for cache.