freemarker.template.cache
Interface CachingStrategy

All Superinterfaces:
Cache, Updateable
All Known Implementing Classes:
BaseCachingStrategy, LoadAdHocCachingStrategy, LoadOnDemandCachingStrategy, LoDWithRefreshCachingStrategy, NullCachingStrategy, PreloadCachingStrategy

public interface CachingStrategy
extends Updateable, Cache

Interface for a cache loading strategy. Items may be loaded and cached based on a variety of algorithms. This interface abstracts out the loading policy from the rest of the caching machinery.

Version:
$Id: CachingStrategy.java 1101 2013-04-01 04:17:32Z run2000 $
Author:
Nicholas Cull
See Also:
Updateable

Method Summary
 void clearCache()
          Clears all the elements in the cache.
 CacheRetriever getCacheRetriever()
          Retrieve the CacheRetriever currently being used.
 java.lang.String getDefaultTemplateType()
          Retrieves the default template type to be created when retrieving items from the cache.
 long getDelay()
          Returns the interval between two cache updates.
 int getMaximumAge()
          Retrieves the maximum age a cache item can be before it is evicted from the cache.
 void startAutoUpdate()
          Begins automatic updates of the cache.
 
Methods inherited from interface freemarker.template.cache.Updateable
update, update, update
 
Methods inherited from interface freemarker.template.cache.Cache
addCacheListener, getCacheListeners, getItem, getItem, listCachedFiles, removeCacheListener, stopAutoUpdate
 

Method Detail

getCacheRetriever

CacheRetriever getCacheRetriever()
Retrieve the CacheRetriever currently being used.

Returns:
the current CacheRetriever

getDelay

long getDelay()
Returns the interval between two cache updates. This is meaningful only if the cache policy is a load-on-demand or preload type.

Returns:
the number of seconds between cache updates

getMaximumAge

int getMaximumAge()
Retrieves the maximum age a cache item can be before it is evicted from the cache. The age is determined as the number of cache updates since the item was last accessed. This is meaningful only if the cache policy is a load-on-demand type.

Returns:
the maximum age before an item is evicted from the cache

getDefaultTemplateType

java.lang.String getDefaultTemplateType()
Retrieves the default template type to be created when retrieving items from the cache.

Returns:
the type of template cached by default

clearCache

void clearCache()
Clears all the elements in the cache.


startAutoUpdate

void startAutoUpdate()
Begins automatic updates of the cache.