|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.opensymphony.oscache.base.AbstractCacheAdministrator
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 | |
protected java.lang.String |
algorithmClass
The algorithm class being used, as specified by the CACHE_ALGORITHM_KEY
configuration property. |
protected static java.lang.String |
CACHE_ALGORITHM_KEY
A String cache configuration property that specifies the classname of an alternate caching algorithm. |
protected static java.lang.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. |
protected static java.lang.String |
CACHE_CAPACITY_KEY
An integer cache configuration property that specifies the maximum number of objects to hold in the cache. |
protected static java.lang.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. |
protected static java.lang.String |
CACHE_ENTRY_EVENT_LISTENERS
A String cache configuration property that holds a comma-delimited list of classnames. |
protected static java.lang.String |
CACHE_MEMORY_KEY
A boolean cache configuration property that indicates whether the cache should cache objects in memory. |
protected int |
cacheCapacity
The cache capacity (number of entries), as specified by the CACHE_CAPACITY_KEY
configuration property. |
protected Config |
config
|
protected javax.swing.event.EventListenerList |
listenerList
Holds a list of all the registered event listeners. |
protected static java.lang.String |
PERSISTENCE_CLASS
A String cache configuration property that specifies the classname that will be used to provide cache persistence. |
Constructor Summary | |
protected |
AbstractCacheAdministrator()
Create the AbstractCacheAdministrator. |
protected |
AbstractCacheAdministrator(java.util.Properties p)
Create the AbstractCacheAdministrator. |
Method Summary | |
protected Cache |
configureStandardListeners(Cache cache)
Applies all of the recognised listener classes to the supplied cache object. |
protected void |
finalizeListeners(Cache cache)
Finalizes all the listeners that are associated with the given cache object. |
protected CacheEventListener[] |
getCacheEventListeners()
Retrieves an array containing instances all of the CacheEventListener
classes that are specified in the OSCache configuration file. |
java.lang.String |
getProperty(java.lang.String key)
Retrieves the value of one of the configuration properties. |
boolean |
isBlocking()
Indicates whether the cache will block waiting for new content to be built, or serve stale content instead of waiting. |
boolean |
isMemoryCaching()
Whether entries are cached in memory or not. |
boolean |
isUnlimitedDiskCache()
Indicates whether the unlimited disk cache is enabled or not. |
void |
setAlgorithmClass(java.lang.String newAlgorithmClass)
Sets the algorithm to use for the cache. |
protected void |
setCacheCapacity(int newCacheCapacity)
Sets the cache capacity (number of items). |
protected Cache |
setPersistenceListener(Cache cache)
If there is a PersistenceListener in the configuration
it will be instantiated and applied to the given cache object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final java.lang.String CACHE_MEMORY_KEY
false
to disable in-memory caching.
protected static final java.lang.String CACHE_CAPACITY_KEY
protected static final java.lang.String CACHE_ALGORITHM_KEY
AbstractConcurrentReadCache
By default caches will use LRUCache
as
the default algorithm if the cache capacity is set to a postive value, or
UnlimitedCache
if the
capacity is negative (ie, disabled).
protected static final java.lang.String CACHE_DISK_UNLIMITED_KEY
true
to allow the
persistent cache to grow without bound.
protected static final java.lang.String CACHE_BLOCKING_KEY
protected static final java.lang.String PERSISTENCE_CLASS
PersistenceListener
.
protected static final java.lang.String CACHE_ENTRY_EVENT_LISTENERS
protected Config config
protected javax.swing.event.EventListenerList listenerList
CACHE_ENTRY_EVENT_LISTENERS
configuration key.
protected java.lang.String algorithmClass
CACHE_ALGORITHM_KEY
configuration property.
protected int cacheCapacity
CACHE_CAPACITY_KEY
configuration property.
Constructor Detail |
protected AbstractCacheAdministrator()
protected AbstractCacheAdministrator(java.util.Properties p)
p
- the configuration properties for this cache.Method Detail |
public void setAlgorithmClass(java.lang.String newAlgorithmClass)
newAlgorithmClass
- The class to use (eg.
"com.opensymphony.oscache.base.algorithm.LRUCache"
)LRUCache
,
FIFOCache
,
UnlimitedCache
public boolean isBlocking()
protected void setCacheCapacity(int newCacheCapacity)
Cache
objects
are updated correctly (by calling AbstractConcurrentReadCache.setMaxEntries(int)
}}.
newCacheCapacity
- The new capacitypublic boolean isMemoryCaching()
cache.memory
property.
public java.lang.String getProperty(java.lang.String key)
key
- The key assigned to the property
null
if the property could not be found.public boolean isUnlimitedDiskCache()
protected CacheEventListener[] getCacheEventListeners()
CacheEventListener
classes that are specified in the OSCache configuration file.
protected Cache setPersistenceListener(Cache cache)
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
.
cache
- the cache to apply the PersistenceListener
to.
protected Cache configureStandardListeners(Cache cache)
CacheEntryEventListener
and CacheMapAccessEventListener
.
cache
- The cache to apply the configuration to.
protected void finalizeListeners(Cache cache)
FinalizationException
s that are thrown by the listeners will
be caught and logged.
|
See www.opensymphony.com for more information. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |