public class SoftCacheStorage extends java.lang.Object implements ConcurrentCacheStorage, CacheStorageWithGetSize
SoftReference objects to hold the objects it was passed,
therefore allows the garbage collector to purge the cache when it determines that it wants to free up memory. This
class is thread-safe to the extent that its underlying map is. The parameterless constructor uses a thread-safe map
since 2.3.24 or Java 5.| Constructor and Description |
|---|
SoftCacheStorage()
Creates an instance that uses a
ConcurrentMap internally. |
SoftCacheStorage(java.util.Map backingMap) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
java.lang.Object |
get(java.lang.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(java.lang.Object key,
java.lang.Object value) |
void |
remove(java.lang.Object key) |
public SoftCacheStorage()
ConcurrentMap internally.public SoftCacheStorage(java.util.Map backingMap)
public boolean isConcurrent()
ConcurrentMap.isConcurrent in interface ConcurrentCacheStoragepublic java.lang.Object get(java.lang.Object key)
get in interface CacheStoragepublic void put(java.lang.Object key,
java.lang.Object value)
put in interface CacheStoragepublic void remove(java.lang.Object key)
remove in interface CacheStoragepublic void clear()
clear in interface CacheStoragepublic int getSize()
getSize in interface CacheStorageWithGetSize