Save This Page
Home » oscache-2.4.1-full » com.opensymphony.oscache » base » [javadoc | source]
com.opensymphony.oscache.base
abstract public class: AbstractCacheAdministrator [javadoc | source]
java.lang.Object
   com.opensymphony.oscache.base.AbstractCacheAdministrator

All Implemented Interfaces:
    Serializable

Direct Known Subclasses:
    GeneralCacheAdministrator, ServletCacheAdministrator

An AbstractCacheAdministrator defines an abstract cache administrator, implementing all the basic operations related to the configuration of a cache, including assigning any configured event handlers to cache objects.

Extend this class to implement a custom cache administrator.

Field Summary
public static final  String CACHE_MEMORY_KEY    A boolean cache configuration property that indicates whether the cache should cache objects in memory. Set this property to false to disable in-memory caching. 
public static final  String CACHE_CAPACITY_KEY    An integer cache configuration property that specifies the maximum number of objects to hold in the cache. Setting this to a negative value will disable the capacity functionality - there will be no limit to the number of objects that are held in cache. 
public static final  String CACHE_ALGORITHM_KEY    A String cache configuration property that specifies the classname of an alternate caching algorithm. This class must extend com.opensymphony.oscache.base.algorithm.AbstractConcurrentReadCache By default caches will use com.opensymphony.oscache.base.algorithm.LRUCache as the default algorithm if the cache capacity is set to a postive value, or com.opensymphony.oscache.base.algorithm.UnlimitedCache if the capacity is negative (ie, disabled). 
public static final  String CACHE_DISK_UNLIMITED_KEY    A boolean cache configuration property that indicates whether the persistent cache should be unlimited in size, or should be restricted to the same size as the in-memory cache. Set this property to true to allow the persistent cache to grow without bound. 
public static final  String CACHE_BLOCKING_KEY    The configuration key that specifies whether we should block waiting for new content to be generated, or just serve the old content instead. The default behaviour is to serve the old content since that provides the best performance (at the cost of serving slightly stale data). 
public static final  String PERSISTENCE_CLASS_KEY    A String cache configuration property that specifies the classname that will be used to provide cache persistence. This class must extend PersistenceListener
public static final  String CACHE_PERSISTENCE_OVERFLOW_KEY    A String cache configuration property that specifies if the cache persistence will only be used in overflow mode, that is, when the memory cache capacity has been reached. 
public static final  String CACHE_ENTRY_EVENT_LISTENERS_KEY    A String cache configuration property that holds a comma-delimited list of classnames. These classes specify the event handlers that are to be applied to the cache. 
protected  Config config     
protected  EventListenerList listenerList    Holds a list of all the registered event listeners. Event listeners are specified using the #CACHE_ENTRY_EVENT_LISTENERS_KEY configuration key. 
protected  String algorithmClass    The algorithm class being used, as specified by the #CACHE_ALGORITHM_KEY configuration property. 
protected  int cacheCapacity    The cache capacity (number of entries), as specified by the #CACHE_CAPACITY_KEY configuration property. 
Constructor:
 protected AbstractCacheAdministrator() 
 protected AbstractCacheAdministrator(Properties p) 
    Create the AbstractCacheAdministrator.
    Parameters:
    p - the configuration properties for this cache.
Method from com.opensymphony.oscache.base.AbstractCacheAdministrator Summary:
configureStandardListeners,   finalizeListeners,   getCacheEventListeners,   getProperty,   isBlocking,   isMemoryCaching,   isOverflowPersistence,   isUnlimitedDiskCache,   setAlgorithmClass,   setCacheCapacity,   setOverflowPersistence,   setPersistenceListener
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.opensymphony.oscache.base.AbstractCacheAdministrator Detail:
 protected Cache configureStandardListeners(Cache cache) 
 protected  void finalizeListeners(Cache cache) 
    Finalizes all the listeners that are associated with the given cache object. Any FinalizationExceptions that are thrown by the listeners will be caught and logged.
 protected CacheEventListener[] getCacheEventListeners() 
    Retrieves an array containing instances all of the CacheEventListener classes that are specified in the OSCache configuration file.
 public String getProperty(String key) 
    Retrieves the value of one of the configuration properties.
 public boolean isBlocking() 
    Indicates whether the cache will block waiting for new content to be built, or serve stale content instead of waiting. Regardless of this setting, the cache will always block if new content is being created, ie, there's no stale content in the cache that can be served.
 public boolean isMemoryCaching() 
    Whether entries are cached in memory or not. Default is true. Set by the cache.memory property.
 public boolean isOverflowPersistence() 
    Check if we use overflowPersistence
 public boolean isUnlimitedDiskCache() 
    Indicates whether the unlimited disk cache is enabled or not.
 public  void setAlgorithmClass(String newAlgorithmClass) 
    Sets the algorithm to use for the cache.
 protected  void setCacheCapacity(int newCacheCapacity) 
 public  void setOverflowPersistence(boolean overflowPersistence) 
    Sets the overflowPersistence flag
 protected Cache setPersistenceListener(Cache cache) 
    If there is a PersistenceListener in the configuration it will be instantiated and applied to the given cache object. If the PersistenceListener cannot be found or instantiated, an error will be logged but the cache will not have a persistence listener applied to it and no exception will be thrown.

    A cache can only have one PersistenceListener.