public class CacheIdentityMap extends FullIdentityMap
Purpose: A fixed size LRU cache
Using a linked list as well as the map from the superclass a LRU cache is maintained. When a get is executed the LRU list is updated and when a new object is inserted the object at the start of the list is deleted (provided the maxSize has been reached).
Responsibilities:
| Constructor and Description |
|---|
CacheIdentityMap(int size,
ClassDescriptor descriptor,
AbstractSession session,
boolean isolated) |
| Modifier and Type | Method and Description |
|---|---|
CacheKey |
createCacheKey(java.lang.Object primaryKey,
java.lang.Object object,
java.lang.Object writeLockValue,
long readTime)
Create the correct type of CacheKey for this map.
|
CacheKey |
getCacheKey(java.lang.Object primaryKeys,
boolean forMerge)
Access the object within the table for the given primaryKey.
|
java.lang.Object |
remove(CacheKey key)
Remove the LinkedCacheKey from the cache as well as from the linked list.
|
void |
updateMaxSize(int maxSize)
INTERNAL:
This method will be used to update the max cache size, any objects exceeding the max cache size will
be remove from the cache.
|
clone, collectLocks, elements, getCacheKeys, getSize, getSize, keys, keys, lazyRelationshipLoaded, put, resetCacheKeyacquireDeferredLock, acquireLock, acquireLockNoWait, acquireLockWithWait, acquireReadLockOnCacheKey, acquireReadLockOnCacheKeyNoWait, containsKey, get, getAllCacheKeysFromIdentityMapWithEntityPK, getAllFromIdentityMapWithEntityPK, getCacheKeyForLock, getDefaultIdentityMapClass, getDescriptor, getDescriptorClass, getMaxSize, getWrapper, getWriteLockValue, release, remove, setDescriptor, setWrapper, setWriteLockValue, toStringpublic CacheIdentityMap(int size,
ClassDescriptor descriptor,
AbstractSession session,
boolean isolated)
public CacheKey createCacheKey(java.lang.Object primaryKey, java.lang.Object object, java.lang.Object writeLockValue, long readTime)
AbstractIdentityMapcreateCacheKey in class AbstractIdentityMappublic CacheKey getCacheKey(java.lang.Object primaryKeys, boolean forMerge)
getCacheKey in interface IdentityMapgetCacheKey in class FullIdentityMapprimaryKeys - is the primary key for the object to search for.public java.lang.Object remove(CacheKey key)
remove in interface IdentityMapremove in class FullIdentityMappublic void updateMaxSize(int maxSize)
updateMaxSize in interface IdentityMapupdateMaxSize in class AbstractIdentityMapEclipseLink 2.6.3, "build v20160428-59c81c5" API Reference