Package freemarker.cache
Interface CacheStorage
- All Known Subinterfaces:
ConcurrentCacheStorage
- All Known Implementing Classes:
MruCacheStorage,SoftCacheStorage,StrongCacheStorage
public interface CacheStorage
Cache storage abstracts away the storage aspects of a cache - associating
an object with a key, retrieval and removal via the key. It is actually a
small subset of the
Map interface.
The implementations can be coded in a non-threadsafe manner as the natural
user of the cache storage, TemplateCache does the necessary
synchronization.-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all values from this cacheRetrieve a cached value associated with a keyvoidAssociates a key with a cached valuevoidRemoves the value associated with a key, if it exists.
-
Method Details
-
get
Retrieve a cached value associated with a key- Parameters:
key- the key for retrieving an associated value- Returns:
- the cached value associated with the key, or null if no value is associated with the key.
-
put
Associates a key with a cached value- Parameters:
key- the key to associate with a valuevalue- the value associated with the key.
-
remove
Removes the value associated with a key, if it exists. If it doesn't exist, this method does nothing.- Parameters:
key- the key whose associated value is removed from the cache.
-
clear
void clear()Removes all values from this cache
-