Package freemarker.cache
Class StrongCacheStorage
java.lang.Object
freemarker.cache.StrongCacheStorage
- All Implemented Interfaces:
CacheStorage
,CacheStorageWithGetSize
,ConcurrentCacheStorage
public class StrongCacheStorage
extends Object
implements ConcurrentCacheStorage, CacheStorageWithGetSize
Strong cache storage is a cache storage that simply wraps a
Map
. It holds a strong reference to all objects
it was passed, therefore prevents the cache from being purged during garbage collection. This class is always
thread-safe since 2.3.24, before that if we are running on Java 5 or later.-
Constructor Summary
-
Method Summary
-
Constructor Details
-
StrongCacheStorage
public StrongCacheStorage()
-
-
Method Details
-
isConcurrent
public boolean isConcurrent()Always returnstrue
.- Specified by:
isConcurrent
in interfaceConcurrentCacheStorage
- Returns:
- true if this instance of cache storage is concurrently accessible from multiple threads without synchronization.
-
get
- Specified by:
get
in interfaceCacheStorage
-
put
- Specified by:
put
in interfaceCacheStorage
-
remove
- Specified by:
remove
in interfaceCacheStorage
-
getSize
public int getSize()Returns a close approximation of the number of cache entries.- Specified by:
getSize
in interfaceCacheStorageWithGetSize
- Since:
- 2.3.21
-
clear
public void clear()- Specified by:
clear
in interfaceCacheStorage
-