Class SoftReferenceMemoryCache<K,V>
java.lang.Object
org.apache.commons.jcs3.engine.memory.AbstractMemoryCache<K,V>
org.apache.commons.jcs3.engine.memory.soft.SoftReferenceMemoryCache<K,V>
- All Implemented Interfaces:
IMemoryCache<K,V>
A JCS IMemoryCache that has
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
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionChildren must implement this method.intfreeElements(int numberToFree) This can't be implemented.Get an Array of the keys for all elements in the memory cacheintgetSize()Returns the current cache size.Returns the historical and statistical data for a region's memory cache.voidinitialize(CompositeCache<K, V> hub) For post reflection creation initializationprotected voidUpdate control structures after get (guarded by the lock)protected voidRemoves all cached items from the cache control structures.protected voidRemove element from control structure (guarded by the lock)voidupdate(ICacheElement<K, V> ce) Puts an item to the cache.Methods inherited from class org.apache.commons.jcs3.engine.memory.AbstractMemoryCache
dispose, dumpMap, get, getCacheAttributes, getCacheName, getCompositeCache, getMultiple, getQuiet, remove, removeAll, removeByGroup, removeByHierarchy, setCacheAttributes, waterfal
-
Constructor Details
-
SoftReferenceMemoryCache
public SoftReferenceMemoryCache()
-
-
Method Details
-
initialize
For post reflection creation initialization- Specified by:
initializein interfaceIMemoryCache<K,V> - Overrides:
initializein classAbstractMemoryCache<K,V> - Parameters:
hub-
-
createMap
Description copied from class:AbstractMemoryCacheChildren must implement this method. A FIFO implementation may use a tree map. An LRU might use a hashtable. The map returned should be threadsafe.- Specified by:
createMapin classAbstractMemoryCache<K,V> - Returns:
- a threadsafe Map
- See Also:
-
getKeySet
Description copied from class:AbstractMemoryCacheGet an Array of the keys for all elements in the memory cache- Specified by:
getKeySetin interfaceIMemoryCache<K,V> - Overrides:
getKeySetin classAbstractMemoryCache<K,V> - Returns:
- An Object[]
- See Also:
-
getSize
Returns the current cache size.- Specified by:
getSizein interfaceIMemoryCache<K,V> - Overrides:
getSizein classAbstractMemoryCache<K,V> - Returns:
- The size value
-
getStatistics
Description copied from interface:IMemoryCacheReturns the historical and statistical data for a region's memory cache.- Specified by:
getStatisticsin interfaceIMemoryCache<K,V> - Overrides:
getStatisticsin classAbstractMemoryCache<K,V> - Returns:
- statistics about the cache
-
lockedGetElement
Update control structures after get (guarded by the lock)- Specified by:
lockedGetElementin classAbstractMemoryCache<K,V> - Parameters:
me- the memory element descriptor
-
lockedRemoveElement
Remove element from control structure (guarded by the lock)- Specified by:
lockedRemoveElementin classAbstractMemoryCache<K,V> - Parameters:
me- the memory element descriptor
-
lockedRemoveAll
Removes all cached items from the cache control structures. (guarded by the lock)- Specified by:
lockedRemoveAllin classAbstractMemoryCache<K,V>
-
update
Puts an item to the cache.- Specified by:
updatein interfaceIMemoryCache<K,V> - Specified by:
updatein classAbstractMemoryCache<K,V> - Parameters:
ce- Description of the Parameter- Throws:
IOException- Description of the Exception
-
freeElements
This can't be implemented.- Parameters:
numberToFree-- Returns:
- 0
- Throws:
IOException
-