org.ehcache.core.spi.cache.tiering
Interface LowerCachingTier<K,V>

All Superinterfaces:
ConfigurationChangeSupport
All Known Implementing Classes:
AbstractOffHeapStore, OffHeapDiskStore, OffHeapStore

public interface LowerCachingTier<K,V>
extends ConfigurationChangeSupport

Lower caching tier, according to Montreal design.


Nested Class Summary
static interface LowerCachingTier.Provider
           
 
Method Summary
 void clear()
          Empty out the caching store.
 Store.ValueHolder<V> getAndRemove(K key)
          Return the value holder currently in the caching tier and remove it.
 Store.ValueHolder<V> installMapping(K key, Function<K,Store.ValueHolder<V>> source)
          Either return the value holder currently in the caching tier, or compute and store it when it isn't present.
 void invalidate(K key)
          Remove a mapping.
 void invalidate(K key, NullaryFunction<K> function)
          Remove a mapping, then call a function under the same lock scope irrespectively of a mapping being there or not.
 void setInvalidationListener(CachingTier.InvalidationListener<K,V> invalidationListener)
          Set the caching tier's invalidation listener.
 
Methods inherited from interface org.ehcache.core.spi.cache.ConfigurationChangeSupport
getConfigurationChangeListeners
 

Method Detail

installMapping

Store.ValueHolder<V> installMapping(K key,
                                    Function<K,Store.ValueHolder<V>> source)
                                    throws CacheAccessException
Either return the value holder currently in the caching tier, or compute and store it when it isn't present. Note that in case of expired value holders null will be returned and the mapping will be invalidated.

Parameters:
key - the key.
source - the function that computes the value.
Returns:
the value holder, or null.
Throws:
CacheAccessException

getAndRemove

Store.ValueHolder<V> getAndRemove(K key)
                                  throws CacheAccessException
Return the value holder currently in the caching tier and remove it.

Parameters:
key - the key.
Returns:
the value holder, or null.
Throws:
CacheAccessException

invalidate

void invalidate(K key)
                throws CacheAccessException
Remove a mapping.

Parameters:
key - the key.
Throws:
CacheAccessException

invalidate

void invalidate(K key,
                NullaryFunction<K> function)
                throws CacheAccessException
Remove a mapping, then call a function under the same lock scope irrespectively of a mapping being there or not.

Parameters:
key - the key.
function - the function to call.
Throws:
CacheAccessException

clear

void clear()
           throws CacheAccessException
Empty out the caching store.

Throws:
CacheAccessException

setInvalidationListener

void setInvalidationListener(CachingTier.InvalidationListener<K,V> invalidationListener)
Set the caching tier's invalidation listener. The invalidation listener can only be set once.

Parameters:
invalidationListener - the listener.
Throws:
java.lang.IllegalStateException - if the invalidation listener is already set.