public class StrongCacheStorage extends Object implements ConcurrentCacheStorage, CacheStorageWithGetSize
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 uses a concurrent map on Java 5 and above, so it's
thread-safe in that case.| Constructor and Description |
|---|
StrongCacheStorage() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
Object |
get(Object key) |
int |
getSize()
Returns a close approximation of the number of cache entries.
|
boolean |
isConcurrent()
Returns true if the underlying Map is a
ConcurrentMap. |
void |
put(Object key,
Object value) |
void |
remove(Object key) |
public boolean isConcurrent()
ConcurrentMap.isConcurrent in interface ConcurrentCacheStoragepublic Object get(Object key)
get in interface CacheStoragepublic void put(Object key, Object value)
put in interface CacheStoragepublic void remove(Object key)
remove in interface CacheStoragepublic int getSize()
getSize in interface CacheStorageWithGetSizepublic void clear()
clear in interface CacheStorage