public class SoftReferenceMemoryCache<K,V> extends AbstractMemoryCache<K,V>
SoftReference to all its values.
This cache does not respect ICompositeCacheAttributes.getMaxObjects()
as overflowing is handled by Java GC.
The cache also has strong references to a maximum number of objects given by the maxObjects parameter
| Constructor and Description |
|---|
SoftReferenceMemoryCache() |
| Modifier and Type | Method and Description |
|---|---|
ConcurrentMap<K,MemoryElementDescriptor<K,V>> |
createMap()
Children must implement this method.
|
int |
freeElements(int numberToFree)
This can't be implemented.
|
ICacheElement<K,V> |
get(K key)
Get an item from the cache
|
Set<K> |
getKeySet()
Get a set of the keys for all elements in the memory cache
|
int |
getSize()
Returns the current cache size.
|
IStats |
getStatistics()
Returns the historical and statistical data for a region's memory cache.
|
void |
initialize(CompositeCache<K,V> hub)
For post reflection creation initialization
|
boolean |
remove(K key)
Removes an item from the cache.
|
void |
removeAll()
Removes all cached items from the cache.
|
void |
update(ICacheElement<K,V> ce)
Puts an item to the cache.
|
dispose, dumpMap, getCacheAttributes, getCacheName, getCompositeCache, getMultiple, getQuiet, getStatus, setCacheAttributes, waterfalpublic SoftReferenceMemoryCache()
public void initialize(CompositeCache<K,V> hub)
initialize in interface IMemoryCache<K,V>initialize in class AbstractMemoryCache<K,V>hub - public ConcurrentMap<K,MemoryElementDescriptor<K,V>> createMap()
AbstractMemoryCachecreateMap in class AbstractMemoryCache<K,V>AbstractMemoryCache.createMap()public Set<K> getKeySet()
AbstractMemoryCachegetKeySet in interface IMemoryCache<K,V>getKeySet in class AbstractMemoryCache<K,V>IMemoryCache.getKeySet()public int getSize()
getSize in interface IMemoryCache<K,V>getSize in class AbstractMemoryCache<K,V>public IStats getStatistics()
IMemoryCachegetStatistics in interface IMemoryCache<K,V>getStatistics in class AbstractMemoryCache<K,V>public boolean remove(K key) throws IOException
remove in interface IMemoryCache<K,V>remove in class AbstractMemoryCache<K,V>key - IOExceptionpublic void removeAll() throws IOException
removeAll in interface IMemoryCache<K,V>removeAll in class AbstractMemoryCache<K,V>IOExceptionpublic void update(ICacheElement<K,V> ce) throws IOException
update in interface IMemoryCache<K,V>update in class AbstractMemoryCache<K,V>ce - Description of the ParameterIOException - Description of the Exceptionpublic ICacheElement<K,V> get(K key) throws IOException
get in interface IMemoryCache<K,V>get in class AbstractMemoryCache<K,V>key - Description of the ParameterIOException - Description of the Exceptionpublic int freeElements(int numberToFree) throws IOException
numberToFree - IOExceptionCopyright © 2002–2018 The Apache Software Foundation. All rights reserved.