|
ehcache | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.ehcache.util.concurrent.ConcurrentHashMap<K,V>
net.sf.ehcache.store.cachingtier.CountBasedBackEnd<K,V>
K - the key typeV - the value typepublic class CountBasedBackEnd<K,V>
A backend to a OnHeapCachingTier that will be cap'ed based on the amount of entries
| Nested Class Summary |
|---|
| 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 | |
|---|---|
CountBasedBackEnd(long maxEntriesLocalHeap)
Constructs a cap'ed backend |
|
CountBasedBackEnd(long maxEntriesLocalHeap,
Policy policy)
Constructs a cap'ed backend |
|
| Method Summary | |
|---|---|
void |
clear(boolean notify)
Basically CHM.clear() |
long |
getMaxEntriesLocalHeap()
Reads the current capacity limit |
Policy |
getPolicy()
queries the potential eviction policy for the heap caching tier |
boolean |
hasSpace()
Return true if this tier has enough space for more entries. |
V |
putIfAbsent(K key,
V value)
|
void |
recalculateSize(K key)
This is evil! Don't call this! |
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. |
void |
setMaxEntriesLocalHeap(long maxEntriesLocalHeap)
Sets the capacity limit |
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, get, getRandomValues, getValueOrDefault, hashCode, internalPutIfAbsent, isEmpty, keys, keySet, keySet, keySpliterator, mappingCount, newKeySet, newKeySet, put, putAll, remove, remove, removeAndNotify, removeAndNotify, replace, replace, 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, get, remove, replace, size |
| Constructor Detail |
|---|
public CountBasedBackEnd(long maxEntriesLocalHeap)
maxEntriesLocalHeap - amount of mappings this should hold before it starts evicting
public CountBasedBackEnd(long maxEntriesLocalHeap,
Policy policy)
maxEntriesLocalHeap - amount of mappings this should hold before it starts evictingpolicy - the policy it'll use to decide what to evict| Method Detail |
|---|
public void setPolicy(Policy policy)
setPolicy in interface HeapCacheBackEnd<K,V>policy - the new eviction Policy to use
public V putIfAbsent(K key,
V value)
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 void registerEvictionCallback(HeapCacheBackEnd.EvictionCallback<K,V> evictionCallback)
registerEvictionCallback in interface HeapCacheBackEnd<K,V>evictionCallback - the thing to call back onpublic void recalculateSize(K key)
HeapCacheBackEnd
recalculateSize in interface HeapCacheBackEnd<K,V>recalculateSize in class ConcurrentHashMap<K,V>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 keypublic Policy getPolicy()
HeapCacheBackEnd
getPolicy in interface HeapCacheBackEnd<K,V>public 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 void setMaxEntriesLocalHeap(long maxEntriesLocalHeap)
maxEntriesLocalHeap - the new limitpublic long getMaxEntriesLocalHeap()
|
ehcache | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||