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.
|
Set<K> |
getKeySet()
Get an Array 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
|
protected void |
lockedGetElement(MemoryElementDescriptor<K,V> me)
Update control structures after get
(guarded by the lock)
|
protected void |
lockedRemoveAll()
Removes all cached items from the cache control structures.
|
protected void |
lockedRemoveElement(MemoryElementDescriptor<K,V> me)
Remove element from control structure
(guarded by the lock)
|
void |
update(ICacheElement<K,V> ce)
Puts an item to the cache.
|
dispose, dumpMap, get, getCacheAttributes, getCacheName, getCompositeCache, getMultiple, getQuiet, remove, removeAll, removeByGroup, removeByHierarchy, 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>
protected void lockedGetElement(MemoryElementDescriptor<K,V> me)
lockedGetElement
in class AbstractMemoryCache<K,V>
me
- the memory element descriptorprotected void lockedRemoveElement(MemoryElementDescriptor<K,V> me)
lockedRemoveElement
in class AbstractMemoryCache<K,V>
me
- the memory element descriptorprotected void lockedRemoveAll()
lockedRemoveAll
in class AbstractMemoryCache<K,V>
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 int freeElements(int numberToFree) throws IOException
numberToFree
- IOException
Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.