ehcache

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 the AuthoritativeTier. An important contract here is that a value being faulted in get(K, java.util.concurrent.Callable, boolean) 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
static interface CachingTier.Listener<K,V>
          A listener that will be notified when eviction of a mapping happens
 
Method Summary
 void addListener(CachingTier.Listener<K,V> listener)
          Adds a CachingTier.Listener to the cache
 void clear()
          Clears the cache...
 boolean contains(K key)
          Deprecated. 
 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()
          Deprecated. 
 int getInMemorySize()
          Deprecated. 
 long getInMemorySizeInBytes()
          Deprecated. 
 int getOffHeapSize()
          Deprecated. 
 long getOffHeapSizeInBytes()
          Deprecated. 
 long getOnDiskSizeInBytes()
          Deprecated. 
 boolean loadOnPut()
          Returns true if values should be loaded to this cache on put.
 void recalculateSize(K key)
          Deprecated. 
 V remove(K key)
          Removes the mapping associated to the key passed in
 void setEvictionPolicy(Policy policy)
          Deprecated. 
 

Method Detail

loadOnPut

boolean loadOnPut()
Returns true 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.

Returns:
true if values should be loaded on put

get

V get(K key,
      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 up
source - the source to use, in the case of no mapping present
updateStats - 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


addListener

void addListener(CachingTier.Listener<K,V> listener)
Adds a CachingTier.Listener to 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

ehcache

Copyright 2001-2014, Terracotta, Inc.