freemarker.template.cache
Interface Cache

All Known Subinterfaces:
CachingStrategy, TemplateCache

public interface Cache

An interface for self-updating caches consisting of any single type of object. The class of objects to be held in the cache is not specified by this interface.

Version:
$Id: Cache.java,v 1.7 2003/11/03 03:33:32 run2000 Exp $
See Also:
Updateable

Method Summary
 void addCacheListener(CacheListener listener)
          Registers a CacheListener for this Cache.
 CacheListener[] getCacheListeners()
          Retrieves all the listeners associated with this Cache.
 Cacheable getItem(java.lang.String name)
          Gets an item from the cache.
 Cacheable getItem(java.lang.String name, java.lang.String type)
          Gets an item of the specified type from the cache.
 java.util.Iterator listCachedFiles()
          Returns an iterator over a list of CacheElement instances.
 void removeCacheListener(CacheListener listener)
          Unregisters a CacheListener for this Cache.
 void stopAutoUpdate()
          Stops automatically updating the cache.
 

Method Detail

addCacheListener

public void addCacheListener(CacheListener listener)
Registers a CacheListener for this Cache.
Parameters:
listener - the CacheListener to be registered.

removeCacheListener

public void removeCacheListener(CacheListener listener)
Unregisters a CacheListener for this Cache.
Parameters:
listener - the CacheListener to be unregistered.

getCacheListeners

public CacheListener[] getCacheListeners()
Retrieves all the listeners associated with this Cache.
Returns:
an array of CacheListeners

stopAutoUpdate

public void stopAutoUpdate()
Stops automatically updating the cache. Normally only call this prior to cache shutdown.

listCachedFiles

public java.util.Iterator listCachedFiles()
Returns an iterator over a list of CacheElement instances.
Returns:
the iterator over a list of CacheElement instances that correspond to templates in the cache

getItem

public Cacheable getItem(java.lang.String name)
Gets an item from the cache. Assumes a default type of object will be returned.
Parameters:
name - a string uniquely identifying the item.
Returns:
the item corresponding to the name, or null if not found.

getItem

public Cacheable getItem(java.lang.String name,
                         java.lang.String type)
Gets an item of the specified type from the cache.
Parameters:
name - a string uniquely identifying the item.
type - the type of item to be retrieved
Returns:
the item corresponding to the name, or null if not found.