K - the key typeV - the value typepublic class PooledBasedBackEnd<K,V> extends ConcurrentHashMap<K,V> implements HeapCacheBackEnd<K,V>
| Modifier and Type | Class and Description |
|---|---|
static class |
PooledBasedBackEnd.PoolParticipant
A pool participant to use with this Backend
|
ConcurrentHashMap.EntrySetView<K,V>, ConcurrentHashMap.KeySetView<K,V>, ConcurrentHashMap.Node, ConcurrentHashMap.RemovalCallback, ConcurrentHashMap.Spliterator<T>, ConcurrentHashMap.TreeNode, ConcurrentHashMap.ValuesView<K,V>HeapCacheBackEnd.EvictionCallback<K,V>FAKE_NODE, FAKE_TREE_NODE| Constructor and Description |
|---|
PooledBasedBackEnd(Policy memoryEvictionPolicy)
Constructs a Pooled backend
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear(boolean notify)
Basically
CHM.clear() |
boolean |
evict(int evictions)
tries to evict as many entries as specified
|
V |
get(Object key)
Returns the value to which the specified key is mapped,
or
null if this map contains no mapping for the key. |
Policy |
getPolicy()
queries the potential eviction policy for the heap caching tier
|
long |
getSizeInBytes()
Deprecated.
|
boolean |
hasSpace()
Return
true if this tier has enough space for more entries. |
V |
put(K key,
V value)
Maps the specified key to the specified value in this table.
|
void |
putAll(Map<? extends K,? extends V> m)
Copies all of the mappings from the specified map to this one.
|
V |
putIfAbsent(K key,
V value) |
void |
registerAccessor(PoolAccessor poolAccessor)
Registers the accessor with the backend.
|
void |
registerEvictionCallback(HeapCacheBackEnd.EvictionCallback<K,V> evictionCallback)
Let's you register a single callback for evictions
|
V |
remove(Object key)
Removes the key (and its corresponding value) from this map.
|
boolean |
remove(Object key,
Object value) |
V |
replace(K key,
V value) |
boolean |
replace(K key,
V oldValue,
V newValue) |
void |
setPolicy(Policy policy)
Dynamic property to switch the policy out
|
clear, contains, containsKey, containsValue, elements, entrySet, entrySpliterator, equals, getRandomValues, getValueOrDefault, hashCode, internalPutIfAbsent, isEmpty, keys, keySet, keySet, keySpliterator, mappingCount, newKeySet, newKeySet, recalculateSize, remove, removeAndNotify, removeAndNotify, setPoolAccessor, size, toString, values, valueSpliteratorclone, finalize, getClass, notify, notifyAll, wait, wait, waitentrySet, recalculateSize, sizecompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAllpublic PooledBasedBackEnd(Policy memoryEvictionPolicy)
memoryEvictionPolicy - the policy it'll use to decide what to evictpublic V putIfAbsent(K key, V value)
ConcurrentHashMapputIfAbsent in interface ConcurrentMap<K,V>putIfAbsent in interface Map<K,V>putIfAbsent in interface HeapCacheBackEnd<K,V>putIfAbsent in class ConcurrentHashMap<K,V>key - key with which the specified value is to be associatedvalue - value to be associated with the specified keynull if there was no mapping for the keypublic V get(Object key)
ConcurrentHashMapnull if this map contains no mapping for the key.
More formally, if this map contains a mapping from a key
k to a value v such that key.equals(k),
then this method returns v; otherwise it returns
null. (There can be at most one such mapping.)
get in interface Map<K,V>get in interface HeapCacheBackEnd<K,V>get in class ConcurrentHashMap<K,V>key - the key whose associated value is to be returnednull if this map contains no mapping for the keypublic void putAll(Map<? extends K,? extends V> m)
ConcurrentHashMappublic V put(K key, V value)
ConcurrentHashMapThe value can be retrieved by calling the get method
with a key that is equal to the original key.
put in interface Map<K,V>put in class ConcurrentHashMap<K,V>key - key with which the specified value is to be associatedvalue - value to be associated with the specified keykey, or
null if there was no mapping for keypublic V remove(Object key)
ConcurrentHashMappublic boolean remove(Object key, Object value)
ConcurrentHashMapremove in interface ConcurrentMap<K,V>remove in interface Map<K,V>remove in interface HeapCacheBackEnd<K,V>remove in class ConcurrentHashMap<K,V>key - key with which the specified value is associatedvalue - value expected to be associated with the specified keypublic boolean replace(K key, V oldValue, V newValue)
ConcurrentHashMapreplace in interface ConcurrentMap<K,V>replace in interface Map<K,V>replace in interface HeapCacheBackEnd<K,V>replace in class ConcurrentHashMap<K,V>key - key with which the specified value is associatedoldValue - value expected to be associated with the specified keynewValue - value to be associated with the specified keypublic V replace(K key, V value)
ConcurrentHashMappublic void clear(boolean notify)
HeapCacheBackEndCHM.clear()clear in interface HeapCacheBackEnd<K,V>notify - whether to notify listeners or notpublic boolean hasSpace()
HeapCacheBackEndtrue if this tier has enough space for more entries.hasSpace in interface HeapCacheBackEnd<K,V>true if there is space for more entries.public boolean evict(int evictions)
evictions - amount of entries to be evictedpublic void setPolicy(Policy policy)
setPolicy in interface HeapCacheBackEnd<K,V>policy - the new eviction Policy to usepublic void registerEvictionCallback(HeapCacheBackEnd.EvictionCallback<K,V> evictionCallback)
HeapCacheBackEndregisterEvictionCallback in interface HeapCacheBackEnd<K,V>evictionCallback - the thing to call back onpublic Policy getPolicy()
HeapCacheBackEndgetPolicy in interface HeapCacheBackEnd<K,V>public void registerAccessor(PoolAccessor poolAccessor)
poolAccessor - the pool accessor to use@Deprecated public long getSizeInBytes()
Copyright 2001-2021, Terracotta, Inc.