MCPcopy Create free account
hub / github.com/apache/freemarker / StrongCacheStorage

Class StrongCacheStorage

src/main/java/freemarker/cache/StrongCacheStorage.java:71–97  ·  view source on GitHub ↗

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 thread-safe to the extent that its underlying map is. The default implementation

Source from the content-addressed store, hash-verified

69 * @author Attila Szegedi
70 */
71public class StrongCacheStorage implements ConcurrentCacheStorage
72{
73 private final Map map = ConcurrentMapFactory.newMaybeConcurrentHashMap();
74
75 /**
76 * Returns true if the underlying Map is a {@code ConcurrentMap}.
77 */
78 public boolean isConcurrent() {
79 return ConcurrentMapFactory.isConcurrent(map);
80 }
81
82 public Object get(Object key) {
83 return map.get(key);
84 }
85
86 public void put(Object key, Object value) {
87 map.put(key, value);
88 }
89
90 public void remove(Object key) {
91 map.remove(key);
92 }
93
94 public void clear() {
95 map.clear();
96 }
97}

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…