ehcache

net.sf.ehcache.store
Class NotifyingMemoryStore

java.lang.Object
  extended by net.sf.ehcache.store.AbstractStore
      extended by net.sf.ehcache.store.MemoryStore
          extended by net.sf.ehcache.store.NotifyingMemoryStore
All Implemented Interfaces:
CacheConfigurationListener, PoolableStore, Store, TierableStore

public final class NotifyingMemoryStore
extends MemoryStore

Author:
Alex Snaps

Field Summary
 
Fields inherited from interface net.sf.ehcache.store.Store
CLUSTER_COHERENT, NODE_COHERENT
 
Method Summary
static NotifyingMemoryStore create(Ehcache cache, Pool pool)
          A factory method to create a MemoryStore.
protected  boolean evict(Element element)
          Evicts the element from the store
 void expireElements()
          Expire all elements.
protected  void notifyDirectEviction(Element element)
          Called when an element is evicted even before it could be installed inside the store
 
Methods inherited from class net.sf.ehcache.store.MemoryStore
bufferFull, canPutWithoutEvicting, containsKey, containsKeyInMemory, containsKeyOffHeap, containsKeyOnDisk, deregistered, diskCapacityChanged, dispose, elementSet, evictFromOnDisk, evictFromOnHeap, expireElement, fill, flush, get, getApproximateDiskByteSize, getApproximateDiskCountSize, getApproximateDiskHitRate, getApproximateDiskMissRate, getApproximateHeapByteSize, getApproximateHeapCountSize, getApproximateHeapHitRate, getApproximateHeapMissRate, getInMemoryEvictionPolicy, getInMemorySize, getInMemorySizeInBytes, getInternalContext, getKeys, getMBean, getOffHeapSize, getOffHeapSizeInBytes, getOnDiskSize, getOnDiskSizeInBytes, getPresentPinnedKeys, getQuiet, getSize, getStatus, getTerracottaClusteredSize, hasAbortedSizeOf, isFull, isPersistent, isPinned, isTierPinned, keySet, loggingChanged, maxBytesLocalDiskChanged, maxBytesLocalHeapChanged, memoryCapacityChanged, put, putIfAbsent, putWithWriter, recalculateSize, registered, remove, removeAll, removeElement, removeIfTierNotPinned, removeNoReturn, removeWithWriter, replace, replace, setInMemoryEvictionPolicy, setPinned, timeToIdleChanged, timeToLiveChanged, unpinAll
 
Methods inherited from class net.sf.ehcache.store.AbstractStore
addStoreListener, executeQuery, getAll, getAllQuiet, getEventListenerList, getSearchAttribute, isCacheCoherent, isClusterCoherent, isNodeCoherent, putAll, removeAll, removeStoreListener, setAttributeExtractors, setNodeCoherent, waitUntilClusterCoherent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.ehcache.store.Store
addStoreListener, executeQuery, getAll, getAllQuiet, getSearchAttribute, isCacheCoherent, isClusterCoherent, isNodeCoherent, putAll, removeAll, removeStoreListener, setAttributeExtractors, setNodeCoherent, waitUntilClusterCoherent
 

Method Detail

create

public static NotifyingMemoryStore create(Ehcache cache,
                                          Pool pool)
A factory method to create a MemoryStore.

Parameters:
cache - the cache
pool - the pool tracking the on-heap usage
Returns:
an instance of a NotifyingMemoryStore, configured with the appropriate eviction policy

evict

protected boolean evict(Element element)
Evicts the element from the store and notifies listeners

Overrides:
evict in class MemoryStore
Parameters:
element - the element to be evicted
Returns:
true if succeeded, false otherwise

notifyDirectEviction

protected void notifyDirectEviction(Element element)
Called when an element is evicted even before it could be installed inside the store

Overrides:
notifyDirectEviction in class MemoryStore
Parameters:
element - the evicted element

expireElements

public void expireElements()
Expire all elements.

This is a default implementation which does nothing. Expiration on demand is only implemented for disk stores.

Specified by:
expireElements in interface Store
Overrides:
expireElements in class MemoryStore

ehcache

Copyright © 2003-2012 Terracotta, Inc.. All Rights Reserved.