Package org.cache2k.core
Class IntHeapCache<V>
- java.lang.Object
-
- org.cache2k.core.BaseCache<K,V>
-
- org.cache2k.core.HeapCache<Integer,V>
-
- org.cache2k.core.IntHeapCache<V>
-
- All Implemented Interfaces:
AutoCloseable,org.cache2k.Cache<Integer,V>,InternalCache<Integer,V>,InternalCacheCloseContext,HeapCacheForEviction<Integer,V>,TimerEventListener<Integer,V>,org.cache2k.DataAware<Integer,V>,org.cache2k.KeyValueSource<Integer,V>
public class IntHeapCache<V> extends HeapCache<Integer,V>
Overwrite methods so the integer value gets stored directly in theEntry.hashCodefield andEntry.valueis set to null.- Author:
- Jens Wilke
-
-
Field Summary
-
Fields inherited from class org.cache2k.core.HeapCache
clearCnt, clearedTime, clearRemovedCnt, clock, exceptionPropagator, hash, internalExceptionCnt, keyMutationCnt, keyType, loader, lock, manager, name, startedTime, timing, valueType
-
-
Constructor Summary
Constructors Constructor Description IntHeapCache(InternalCacheBuildContext<Integer,V> ctx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StampedHash<Integer,V>createHashTable()Modified hash table implementation.IntegerkeyObjFromEntry(Entry<Integer,V> e)Either returns the stored key object or the integer object created from the hashCode field.intspreadHashFromEntry(Entry e)IntegertoEntryKey(Integer key)The key object or null, for integer keyed cachesinttoStoredHashCodeOrKey(Integer key, int hc)We store either the spread hash code or the raw integer key in the hash table-
Methods inherited from class org.cache2k.core.HeapCache
cancelTimerJobs, checkAllPresent, checkClosed, checkIntegrity, clear, clearLocalCache, close, closePart1, closePart2, computeIfAbsent, containsAndRemove, containsKey, convertCacheEntry2ValueMap, convertValueMap, createEntryAction, createFireAndForgetAction, executeLoader, executeWithGlobalLock, expireEntry, finishLoadOrEviction, generateKeySet, get, getAll, getCacheManager, getClock, getCommonMetrics, getConsistentInfo, getConsistentInfo, getEntry, getEntryInternal, getEntryInternal, getEntryState, getEviction, getExecutor, getHashEntries, getInfo, getInfo, getIntegrityState, getKeyType, getLoaderExecutor, getLog, getName, getRefreshExecutor, getTimeReference, getTiming, getTotalEntryCount, getValueType, init, initWithoutTimerHandler, insert, insertNewEntry, insertOrUpdateAndCalculateExpiry, isClosed, isDisabled, isKeepAfterExpired, isLoaderPresent, isNullValuePermitted, isRecordRefreshTime, isRefreshAhead, isRejectNullValues, isUpdateTimeNeeded, isWeigherPresent, iterateAllHeapEntries, iterator, load, loadAll, loadAndReplace, logAndCountInternalException, lookupEntry, lookupEntry, lookupEntryNoHitRecord, lookupEntryNoHitRecord, lookupOrNewEntry, lookupOrNewEntry, lookupOrNewEntryNoHitRecord, peek, peekAll, peekAndPut, peekAndRemove, peekAndReplace, peekEntry, peekEntryInternal, peekEntryInternal, put, putAll, putIfAbsent, putValue, recordHit, reloadAll, remove, removeEntry, removeEntryForEviction, removeIfEquals, replace, replace, replaceIfEquals, returnCacheEntry, returnCacheEntry, returnEntry, returnNullValueDetectedException, returnValue, returnValue, setDisabled, setTiming, spreadHash, startRefreshProbationTimer, timerEventExpireEntry, timerEventProbationTerminated, timerEventRefresh
-
Methods inherited from class org.cache2k.core.BaseCache
asMap, closeCustomization, entries, execute, execute, expireAt, getQualifiedName, invoke, invokeAll, keys, removeAll, removeAll, requestInterface, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.cache2k.core.api.InternalCache
getUserCache
-
-
-
-
Constructor Detail
-
IntHeapCache
public IntHeapCache(InternalCacheBuildContext<Integer,V> ctx)
-
-
Method Detail
-
toEntryKey
public Integer toEntryKey(Integer key)
Description copied from class:HeapCacheThe key object or null, for integer keyed caches- Overrides:
toEntryKeyin classHeapCache<Integer,V>
-
toStoredHashCodeOrKey
public int toStoredHashCodeOrKey(Integer key, int hc)
Description copied from class:HeapCacheWe store either the spread hash code or the raw integer key in the hash table- Overrides:
toStoredHashCodeOrKeyin classHeapCache<Integer,V>
-
spreadHashFromEntry
public int spreadHashFromEntry(Entry e)
- Overrides:
spreadHashFromEntryin classHeapCache<Integer,V>
-
keyObjFromEntry
public Integer keyObjFromEntry(Entry<Integer,V> e)
Description copied from class:HeapCacheEither returns the stored key object or the integer object created from the hashCode field.- Overrides:
keyObjFromEntryin classHeapCache<Integer,V>
-
createHashTable
public StampedHash<Integer,V> createHashTable()
Modified hash table implementation. Rehash needs to calculate the correct hash code again.- Overrides:
createHashTablein classHeapCache<Integer,V>
-
-