K - The key typeV - the value typepublic class OnHeapCachingTier<K,V> extends Object implements CachingTier<K,V>
CachingTier.Listener<K,V>| Constructor and Description |
|---|
OnHeapCachingTier(HeapCacheBackEnd<K,Object> backEnd)
A Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(CachingTier.Listener<K,V> listener)
Adds a
CachingTier.Listener to the cache |
void |
clear()
Clears the cache...
|
void |
clearAndNotify()
Clears the cache notifying listeners
|
boolean |
contains(K key)
This should go away once the stats are in
As the method is only there to know what tier the key is going to be fetched from
|
static OnHeapCachingTier<Object,Element> |
createOnHeapCache(Ehcache cache,
Pool onHeapPool)
Factory method
|
V |
get(K key,
Callable<V> source,
boolean updateStats)
Returns the value associated with the key, or populates the mapping using the Callable instance
|
Policy |
getEvictionPolicy()
queries the potential eviction policy for the heap caching tier
|
int |
getInMemorySize()
Can we avoid having this somehow ?
|
long |
getInMemorySizeInBytes()
CacheTier could keep hold of the PoolAccessors for each tier...
|
int |
getOffHeapSize()
Can we avoid having this somehow ?
|
long |
getOffHeapSizeInBytes()
CacheTier could keep hold of the PoolAccessors for each tier...
|
long |
getOnDiskSizeInBytes()
CacheTier could keep hold of the PoolAccessors for each tier...
|
boolean |
loadOnPut()
Returns
true if values should be loaded to this cache on put. |
void |
recalculateSize(K key)
This is evil! Don't call this!
|
V |
remove(K key)
Removes the mapping associated to the key passed in
|
void |
setEvictionPolicy(Policy policy)
sets the eviction policy on the heap caching tier
|
public OnHeapCachingTier(HeapCacheBackEnd<K,Object> backEnd)
backEnd - the HeapCacheBackEnd that will back this CachingTierpublic static OnHeapCachingTier<Object,Element> createOnHeapCache(Ehcache cache, Pool onHeapPool)
cache - the cache we're planning to backonHeapPool - the pool, if any, to usepublic boolean loadOnPut()
CachingTiertrue if values should be loaded to this cache on put.
This may be a dynamic decision, based for example on the occupancy of the cache.
loadOnPut in interface CachingTier<K,V>true if values should be loaded on putpublic V get(K key, Callable<V> source, boolean updateStats)
CachingTierget in interface CachingTier<K,V>key - the key to look upsource - the source to use, in the case of no mapping presentupdateStats - true to update the stats, false otherwisepublic V remove(K key)
CachingTierremove in interface CachingTier<K,V>key - the key to the mapping to removepublic void clear()
CachingTierclear in interface CachingTier<K,V>public void clearAndNotify()
CachingTierclearAndNotify in interface CachingTier<K,V>public void addListener(CachingTier.Listener<K,V> listener)
CachingTierCachingTier.Listener to the cacheaddListener in interface CachingTier<K,V>listener - the listener to addpublic int getInMemorySize()
CachingTiergetInMemorySize in interface CachingTier<K,V>public int getOffHeapSize()
CachingTiergetOffHeapSize in interface CachingTier<K,V>public boolean contains(K key)
CachingTiercontains in interface CachingTier<K,V>public long getInMemorySizeInBytes()
CachingTiergetInMemorySizeInBytes in interface CachingTier<K,V>public long getOffHeapSizeInBytes()
CachingTiergetOffHeapSizeInBytes in interface CachingTier<K,V>public long getOnDiskSizeInBytes()
CachingTiergetOnDiskSizeInBytes in interface CachingTier<K,V>public void recalculateSize(K key)
CachingTierrecalculateSize in interface CachingTier<K,V>key - the key to perform the recalculation forpublic Policy getEvictionPolicy()
CachingTiergetEvictionPolicy in interface CachingTier<K,V>public void setEvictionPolicy(Policy policy)
CachingTiersetEvictionPolicy in interface CachingTier<K,V>policy - the policy to useCopyright 2001-2021, Terracotta, Inc.