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, waterfal
public 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()
AbstractMemoryCache
createMap
in class AbstractMemoryCache<K,V>
AbstractMemoryCache.createMap()
public Set<K> getKeySet()
AbstractMemoryCache
getKeySet
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()
IMemoryCache
getStatistics
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
- IOException
public void removeAll() throws IOException
removeAll
in interface IMemoryCache<K,V>
removeAll
in class AbstractMemoryCache<K,V>
IOException
public 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
- IOException
Copyright © 2002–2018 The Apache Software Foundation. All rights reserved.