public class SoftCacheStorage extends java.lang.Object implements ConcurrentCacheStorage
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
default implementation uses a concurrent map on Java 5 and above, so it's
thread-safe in that case.Configuration.setCacheStorage(CacheStorage)
Constructor and Description |
---|
SoftCacheStorage() |
SoftCacheStorage(java.util.Map backingMap) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
java.lang.Object |
get(java.lang.Object key) |
boolean |
isConcurrent()
Returns true if this instance of cache storage is concurrently
accessible from multiple threads without synchronization.
|
void |
put(java.lang.Object key,
java.lang.Object value) |
void |
remove(java.lang.Object key) |
public SoftCacheStorage()
public SoftCacheStorage(java.util.Map backingMap)
public boolean isConcurrent()
ConcurrentCacheStorage
isConcurrent
in interface ConcurrentCacheStorage
public java.lang.Object get(java.lang.Object key)
get
in interface CacheStorage
public void put(java.lang.Object key, java.lang.Object value)
put
in interface CacheStorage
public void remove(java.lang.Object key)
remove
in interface CacheStorage
public void clear()
clear
in interface CacheStorage