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
| 69 | * @author Attila Szegedi |
| 70 | */ |
| 71 | public 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 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…