|
ehcache | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.ehcache.util.concurrent.ConcurrentHashMap<K,V> net.sf.ehcache.store.cachingtier.PooledBasedBackEnd<K,V>
K
- the key typeV
- the value typepublic class PooledBasedBackEnd<K,V>
A backend to a OnHeapCachingTier that will be cap'ed using a pool
Nested Class Summary | |
---|---|
static class |
PooledBasedBackEnd.PoolParticipant
A pool participant to use with this Backend |
Nested classes/interfaces inherited from class net.sf.ehcache.util.concurrent.ConcurrentHashMap |
---|
ConcurrentHashMap.EntrySetView<K,V>, ConcurrentHashMap.KeySetView<K,V>, ConcurrentHashMap.Node, ConcurrentHashMap.RemovalCallback, ConcurrentHashMap.Spliterator<T>, ConcurrentHashMap.TreeNode, ConcurrentHashMap.ValuesView<K,V> |
Nested classes/interfaces inherited from interface net.sf.ehcache.store.cachingtier.HeapCacheBackEnd |
---|
HeapCacheBackEnd.EvictionCallback<K,V> |
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Field Summary |
---|
Fields inherited from class net.sf.ehcache.util.concurrent.ConcurrentHashMap |
---|
FAKE_NODE, FAKE_TREE_NODE |
Constructor Summary | |
---|---|
PooledBasedBackEnd(Policy memoryEvictionPolicy)
Constructs a Pooled backend |
Method Summary | |
---|---|
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 |
Methods inherited from class net.sf.ehcache.util.concurrent.ConcurrentHashMap |
---|
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, valueSpliterator |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.sf.ehcache.store.cachingtier.HeapCacheBackEnd |
---|
entrySet, recalculateSize, size |
Constructor Detail |
---|
public PooledBasedBackEnd(Policy memoryEvictionPolicy)
memoryEvictionPolicy
- the policy it'll use to decide what to evictMethod Detail |
---|
public V putIfAbsent(K key, V value)
ConcurrentHashMap
putIfAbsent
in interface ConcurrentMap<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 key
null
if there was no mapping for the keypublic V get(Object key)
ConcurrentHashMap
null
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 returned
null
if this map contains no mapping for the keypublic void putAll(Map<? extends K,? extends V> m)
ConcurrentHashMap
putAll
in interface Map<K,V>
putAll
in class ConcurrentHashMap<K,V>
m
- mappings to be stored in this mappublic V put(K key, V value)
ConcurrentHashMap
The 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 key
key
, or
null
if there was no mapping for key
public V remove(Object key)
ConcurrentHashMap
remove
in interface Map<K,V>
remove
in interface HeapCacheBackEnd<K,V>
remove
in class ConcurrentHashMap<K,V>
key
- the key that needs to be removed
key
, or
null
if there was no mapping for key
public boolean remove(Object key, Object value)
ConcurrentHashMap
remove
in interface ConcurrentMap<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 key
public boolean replace(K key, V oldValue, V newValue)
ConcurrentHashMap
replace
in interface ConcurrentMap<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 key
public V replace(K key, V value)
ConcurrentHashMap
replace
in interface ConcurrentMap<K,V>
replace
in class ConcurrentHashMap<K,V>
null
if there was no mapping for the keypublic void clear(boolean notify)
HeapCacheBackEnd
CHM.clear()
clear
in interface HeapCacheBackEnd<K,V>
notify
- whether to notify listeners or notpublic boolean hasSpace()
HeapCacheBackEnd
true
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 evicted
public void setPolicy(Policy policy)
setPolicy
in interface HeapCacheBackEnd<K,V>
policy
- the new eviction Policy to usepublic void registerEvictionCallback(HeapCacheBackEnd.EvictionCallback<K,V> evictionCallback)
HeapCacheBackEnd
registerEvictionCallback
in interface HeapCacheBackEnd<K,V>
evictionCallback
- the thing to call back onpublic Policy getPolicy()
HeapCacheBackEnd
getPolicy
in interface HeapCacheBackEnd<K,V>
public void registerAccessor(PoolAccessor poolAccessor)
poolAccessor
- the pool accessor to use@Deprecated public long getSizeInBytes()
|
ehcache | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |