org.terracotta.offheapstore
Class AbstractOffHeapClockCache<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
org.terracotta.offheapstore.OffHeapHashMap<K,V>
org.terracotta.offheapstore.AbstractLockedOffHeapHashMap<K,V>
org.terracotta.offheapstore.AbstractOffHeapClockCache<K,V>
- Type Parameters:
K - the type of keys maintained by this mapV - the type of mapped values
- All Implemented Interfaces:
- ConcurrentMap<K,V>, ReadWriteLock, Map<K,V>, MapInternals, PinnableCache<K,V>, PinnableSegment<K,V>, Segment<K,V>, StorageEngine.Owner
- Direct Known Subclasses:
- AbstractPersistentOffHeapCache, ReadWriteLockedOffHeapClockCache, WriteLockedOffHeapClockCache
public abstract class AbstractOffHeapClockCache<K,V>
- extends AbstractLockedOffHeapHashMap<K,V>
- implements PinnableCache<K,V>, PinnableSegment<K,V>
An abstract off-heap cache implementation.
Subclasses must implement the two getEvictionIndex(...) methods to
instruct the cache regarding which mappings to remove.
- Author:
- Chris Dennis, Manoj Govindassamy
| Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
| Fields inherited from class org.terracotta.offheapstore.OffHeapHashMap |
ENTRY_SIZE, hashtable, hashTablePage, modCount, removedSlots, reprobeLimit, RESERVED_STATUS_BITS, size, STATUS, STATUS_USED, storageEngine, tableSource |
|
Constructor Summary |
AbstractOffHeapClockCache(PageSource source,
boolean tableAllocationsSteal,
StorageEngine<? super K,? super V> storageEngine)
|
AbstractOffHeapClockCache(PageSource source,
boolean tableAllocationsSteal,
StorageEngine<? super K,? super V> storageEngine,
int tableSize)
|
AbstractOffHeapClockCache(PageSource source,
StorageEngine<? super K,? super V> storageEngine)
|
AbstractOffHeapClockCache(PageSource source,
StorageEngine<? super K,? super V> storageEngine,
boolean bootstrap)
|
AbstractOffHeapClockCache(PageSource source,
StorageEngine<? super K,? super V> storageEngine,
int tableSize)
|
AbstractOffHeapClockCache(PageSource source,
StorageEngine<? super K,? super V> storageEngine,
int tableSize,
boolean bootstrap)
|
| Methods inherited from class org.terracotta.offheapstore.AbstractLockedOffHeapHashMap |
clear, containsKey, destroy, entrySet, fill, fill, get, getAndSetMetadata, getEncodingForHashAndBinary, installMappingForHashAndEncoding, keySet, put, put, putIfAbsent, readLock, remove, remove, removeMapping, removeNoReturn, replace, replace, setMetadata, shrink, size, values, writeLock |
| Methods inherited from class org.terracotta.offheapstore.OffHeapHashMap |
added, encodingSet, fill, getAllocatedMemory, getAtTableOffset, getDataAllocatedMemory, getDataOccupiedMemory, getDataSize, getDataVitalMemory, getEntryAtTableOffset, getMetadata, getOccupiedMemory, getRemovedSlotCount, getReprobeLength, getSize, getSlotForHashAndEncoding, getStorageEngine, getTableCapacity, getUsedSlotCount, getVitalMemory, isAvailable, isPresent, isRemoved, isTerminating, isThiefForTableAllocations, removeAtTableOffset, removed, spread, tryIncreaseReprobe, updated, updateEncoding, updateMetadata |
| Methods inherited from interface org.terracotta.offheapstore.MapInternals |
getAllocatedMemory, getDataAllocatedMemory, getDataOccupiedMemory, getDataSize, getDataVitalMemory, getOccupiedMemory, getRemovedSlotCount, getReprobeLength, getSize, getTableCapacity, getUsedSlotCount, getVitalMemory |
| Methods inherited from interface java.util.Map |
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
AbstractOffHeapClockCache
public AbstractOffHeapClockCache(PageSource source,
StorageEngine<? super K,? super V> storageEngine)
AbstractOffHeapClockCache
public AbstractOffHeapClockCache(PageSource source,
boolean tableAllocationsSteal,
StorageEngine<? super K,? super V> storageEngine)
AbstractOffHeapClockCache
public AbstractOffHeapClockCache(PageSource source,
StorageEngine<? super K,? super V> storageEngine,
boolean bootstrap)
AbstractOffHeapClockCache
public AbstractOffHeapClockCache(PageSource source,
StorageEngine<? super K,? super V> storageEngine,
int tableSize)
AbstractOffHeapClockCache
public AbstractOffHeapClockCache(PageSource source,
boolean tableAllocationsSteal,
StorageEngine<? super K,? super V> storageEngine,
int tableSize)
AbstractOffHeapClockCache
public AbstractOffHeapClockCache(PageSource source,
StorageEngine<? super K,? super V> storageEngine,
int tableSize,
boolean bootstrap)
storageEngineFailure
protected void storageEngineFailure(Object failure)
- Overrides:
storageEngineFailure in class OffHeapHashMap<K,V>
tableExpansionFailure
protected void tableExpansionFailure(int start,
int length)
- Overrides:
tableExpansionFailure in class OffHeapHashMap<K,V>
hit
protected void hit(IntBuffer entry)
- Overrides:
hit in class OffHeapHashMap<K,V>
getEvictionIndex
public int getEvictionIndex()
- Return the table offset of the to be evicted mapping.
The mapping to be evicted can occur anywhere in this cache's table.
- Returns:
- table offset of the mapping to be evicted
evictable
protected boolean evictable(int status)
evict
public boolean evict(int index,
boolean shrink)
- Specified by:
evict in interface StorageEngine.Owner- Overrides:
evict in class AbstractLockedOffHeapHashMap<K,V>
isPinned
public boolean isPinned(Object key)
- Specified by:
isPinned in interface PinnableCache<K,V>
setPinning
public void setPinning(K key,
boolean pinned)
- Specified by:
setPinning in interface PinnableCache<K,V>
putPinned
public V putPinned(K key,
V value)
- Specified by:
putPinned in interface PinnableCache<K,V>
Copyright © 2015. All Rights Reserved.