Package freemarker.cache
Class StrongCacheStorage
- java.lang.Object
-
- freemarker.cache.StrongCacheStorage
-
- All Implemented Interfaces:
CacheStorage,CacheStorageWithGetSize,ConcurrentCacheStorage
public class StrongCacheStorage extends java.lang.Object implements ConcurrentCacheStorage, CacheStorageWithGetSize
Strong cache storage is a cache storage that simply wraps aMap. 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
Constructors Constructor Description StrongCacheStorage()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()java.lang.Objectget(java.lang.Object key)intgetSize()Returns a close approximation of the number of cache entries.booleanisConcurrent()Always returnstrue.voidput(java.lang.Object key, java.lang.Object value)voidremove(java.lang.Object key)
-
-
-
Method Detail
-
isConcurrent
public boolean isConcurrent()
Always returnstrue.- Specified by:
isConcurrentin interfaceConcurrentCacheStorage- Returns:
- true if this instance of cache storage is concurrently accessible from multiple threads without synchronization.
-
get
public java.lang.Object get(java.lang.Object key)
- Specified by:
getin interfaceCacheStorage
-
put
public void put(java.lang.Object key, java.lang.Object value)- Specified by:
putin interfaceCacheStorage
-
remove
public void remove(java.lang.Object key)
- Specified by:
removein interfaceCacheStorage
-
getSize
public int getSize()
Returns a close approximation of the number of cache entries.- Specified by:
getSizein interfaceCacheStorageWithGetSize- Since:
- 2.3.21
-
clear
public void clear()
- Specified by:
clearin interfaceCacheStorage
-
-