| java.lang.Object freemarker.cache.MruCacheStorage
MruCacheStorage | public class MruCacheStorage implements CacheStorage(Code) | | A cache storage that implements a two-level Most Recently Used cache. In the
first level, items are strongly referenced up to the specified maximum. When
the maximum is exceeded, the least recently used item is moved into the
second level cache, where they are softly referenced, up to another specified
maximum. When the second level maximum is also exceeded, the least recently
used item is discarded altogether. This cache storage is a generalization of
both
StrongCacheStorage and
SoftCacheStorage - the effect of
both of them can be achieved by setting one maximum to zero and the other to
the largest positive integer.
This class is NOT thread-safe. If it is accessed from multiple
threads concurrently, proper synchronization must be provided by the callers.
Note that
TemplateCache , the natural user of this class provides the
necessary synchronizations when it uses the class.
author: Attila Szegedi version: $Id: MruCacheStorage.java,v 1.7.2.1 2007/04/02 13:07:32 szegedia Exp $ |
Constructor Summary | |
public | MruCacheStorage(int maxStrongSize, int maxSoftSize) Creates a new MRU cache storage with specified maximum cache sizes. |
MruCacheStorage | public MruCacheStorage(int maxStrongSize, int maxSoftSize)(Code) | | Creates a new MRU cache storage with specified maximum cache sizes. Each
cache size can vary between 0 and
Integer.MAX_VALUE .
Parameters: maxStrongSize - the maximum number of strongly referenced templates Parameters: maxSoftSize - the maximum number of softly referenced templates |
clear | public void clear()(Code) | | |
|
|