Package net.sf.ehcache.store
Interface CachingTier<K,V>
-
- Type Parameters:
K-V-
- All Known Implementing Classes:
OnHeapCachingTier
public interface CachingTier<K,V>This interface is to be implemented by CachingTier that sit above theAuthoritativeTier. An important contract here is that a value being faulted in get is to be entirely faulted in before it can become an eviction candidate, i.e. this cache can never evict mappings being faulted in- Author:
- Alex Snaps
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceCachingTier.Listener<K,V>A listener that will be notified when eviction of a mapping happens
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidaddListener(CachingTier.Listener<K,V> listener)Adds aCachingTier.Listenerto the cachevoidclear()Clears the cache...voidclearAndNotify()Clears the cache notifying listenersbooleancontains(K key)Deprecated.Vget(K key, java.util.concurrent.Callable<V> source, boolean updateStats)Returns the value associated with the key, or populates the mapping using the Callable instancePolicygetEvictionPolicy()Deprecated.intgetInMemorySize()Deprecated.longgetInMemorySizeInBytes()Deprecated.intgetOffHeapSize()Deprecated.longgetOffHeapSizeInBytes()Deprecated.longgetOnDiskSizeInBytes()Deprecated.booleanloadOnPut()Returnstrueif values should be loaded to this cache on put.voidrecalculateSize(K key)Deprecated.Vremove(K key)Removes the mapping associated to the key passed invoidsetEvictionPolicy(Policy policy)Deprecated.
-
-
-
Method Detail
-
loadOnPut
boolean loadOnPut()
Returnstrueif values should be loaded to this cache on put.This may be a dynamic decision, based for example on the occupancy of the cache.
- Returns:
trueif values should be loaded on put
-
get
V get(K key, java.util.concurrent.Callable<V> source, boolean updateStats)
Returns the value associated with the key, or populates the mapping using the Callable instance- Parameters:
key- the key to look upsource- the source to use, in the case of no mapping presentupdateStats- true to update the stats, false otherwise- Returns:
- the value mapped to the key
-
remove
V remove(K key)
Removes the mapping associated to the key passed in- Parameters:
key- the key to the mapping to remove- Returns:
- the value removed, null if none
-
clear
void clear()
Clears the cache... Doesn't notify any listeners
-
clearAndNotify
void clearAndNotify()
Clears the cache notifying listeners
-
addListener
void addListener(CachingTier.Listener<K,V> listener)
Adds aCachingTier.Listenerto the cache- Parameters:
listener- the listener to add
-
getInMemorySize
@Deprecated int getInMemorySize()
Deprecated.Can we avoid having this somehow ?- Returns:
- the count of entries held in heap
-
getOffHeapSize
@Deprecated int getOffHeapSize()
Deprecated.Can we avoid having this somehow ?- Returns:
- the count of entries held off heap
-
contains
@Deprecated boolean contains(K key)
Deprecated.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- Parameters:
key-- Returns:
-
getInMemorySizeInBytes
@Deprecated long getInMemorySizeInBytes()
Deprecated.CacheTier could keep hold of the PoolAccessors for each tier... But what about non pooled resources ?- Returns:
-
getOffHeapSizeInBytes
@Deprecated long getOffHeapSizeInBytes()
Deprecated.CacheTier could keep hold of the PoolAccessors for each tier... But what about non pooled resources ?- Returns:
-
getOnDiskSizeInBytes
@Deprecated long getOnDiskSizeInBytes()
Deprecated.CacheTier could keep hold of the PoolAccessors for each tier... But what about non pooled resources ?- Returns:
-
recalculateSize
@Deprecated void recalculateSize(K key)
Deprecated.This is evil! Don't call this!- Parameters:
key- the key to perform the recalculation for
-
getEvictionPolicy
@Deprecated Policy getEvictionPolicy()
Deprecated.queries the potential eviction policy for the heap caching tier- Returns:
- the policy
-
setEvictionPolicy
@Deprecated void setEvictionPolicy(Policy policy)
Deprecated.sets the eviction policy on the heap caching tier- Parameters:
policy- the policy to use
-
-