public class SoftCacheWeakIdentityMap extends HardCacheWeakIdentityMap
Purpose: A weak cache is identical to the weak identity map, however the weak can be a performance problem for some types of apps because it can cause too much garbage collection of objects read causing them to be re-read and re-built (this defeats the purpose of the cache). The weak cache solves this through also holding a fixed number of objects is memory to improve caching.
Responsibilities:
HardCacheWeakIdentityMap.ReferenceCacheKeyreferenceCachecleanupCount, cleanupSizecacheKeysmaxSize, searchKey| Constructor and Description |
|---|
SoftCacheWeakIdentityMap(int size) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
buildReference(java.lang.Object object)
Creates a Soft reference if Required
|
boolean |
hasReference(java.lang.Object reference)
Checks if the object is null, or reference's object is null.
|
createCacheKey, getReferenceCache, put, remove, updateMaxSizecleanupDeadCacheKeys, getCleanupCount, getCleanupSize, setCleanupCount, setCleanupSizeclone, collectLocks, elements, getCacheKey, getCacheKeys, getSize, getSize, keys, put, resetCacheKey, resetCacheKey, setCacheKeysacquireDeferredLock, acquireLock, acquireLockNoWait, acquireReadLockOnCacheKey, acquireReadLockOnCacheKeyNoWait, containsKey, createCacheKey, get, getCacheKey, getCacheKeyWithReadLock, getDefaultIdentityMapClass, getMaxSize, getSearchKey, getWrapper, getWriteLockValue, initialize, remove, setMaxSize, setSearchKey, setWrapper, setWriteLockValue, toString, updateCacheKeypublic java.lang.Object buildReference(java.lang.Object object)
buildReference in class HardCacheWeakIdentityMapobject - is the domain object to cache.public boolean hasReference(java.lang.Object reference)
hasReference in class HardCacheWeakIdentityMapthe - object for hard or the reference for soft.