freemarker.template.cache
Class BaseCachingStrategy
java.lang.Object
|
+--freemarker.template.cache.BaseCachingStrategy
- All Implemented Interfaces:
- Cache, CachingStrategy, Updateable
- Direct Known Subclasses:
- LoadAdHocCachingStrategy, LoadOnDemandCachingStrategy, LoDWithRefreshCachingStrategy, NullCachingStrategy, PreloadCachingStrategy
- public abstract class BaseCachingStrategy
- extends java.lang.Object
- implements CachingStrategy
Base class for implementing common elements of the caching strategies
included with FM-Classic.
- Version:
- $Id: BaseCachingStrategy.java,v 1.12 2003/11/08 06:10:01 run2000 Exp $
- Author:
- Nicholas Cull
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
eventHandler
protected CacheEventAdapter eventHandler
- A proxy object for firing cache events to any listening event handlers.
retriever
protected CacheRetriever retriever
- An object from which a caching strategy can retrieve templates.
Typically proxies for a file system.
BaseCachingStrategy
public BaseCachingStrategy()
- Default constructor.
BaseCachingStrategy
public BaseCachingStrategy(CacheRetriever retriever)
- Creates new
BaseCachingStrategy
with a cache retriever.
- Parameters:
retriever
- the retriever to use to pull items from the data store
setCacheRetriever
public void setCacheRetriever(CacheRetriever retriever)
- Sets up a retriever to retrieve cacheable objects.
- Specified by:
setCacheRetriever
in interface CachingStrategy
- Parameters:
retriever
- the new retriever for the cache
getCacheRetriever
public CacheRetriever getCacheRetriever()
- Returns the current retriever.
- Specified by:
getCacheRetriever
in interface CachingStrategy
- Returns:
- the current cache retriever
addCacheListener
public void addCacheListener(CacheListener listener)
- Registers a
CacheListener
for this
Cache
.
- Specified by:
addCacheListener
in interface Cache
- Parameters:
listener
- the CacheListener
to be registered.
getCacheListeners
public CacheListener[] getCacheListeners()
- Returns all the
CacheListener
s registered
with this strategy.
- Specified by:
getCacheListeners
in interface Cache
- Returns:
- an array of
CacheListener
s that have been registered.
removeCacheListener
public void removeCacheListener(CacheListener listener)
- Unregisters a
CacheListener
for this
Cache
.
- Specified by:
removeCacheListener
in interface Cache
- Parameters:
listener
- the CacheListener
to be unregistered.
connectionOk
protected boolean connectionOk()
- Determines whether our data source is still available. If not, fires
a cache event and stops auto-updates, since this is a fatal condition
for the cache to encounter.
- Returns:
true
if the data source is ok, otherwise false
setEventHandler
public void setEventHandler(CacheEventAdapter cHandler)
- Sets the object to be used for firing cache events.
- Specified by:
setEventHandler
in interface CachingStrategy
- Parameters:
cHandler
- the event handler to use for firing events