com.googlecode.ehcache.annotations
Class RefreshingSelfPopulatingCache

java.lang.Object
  extended by net.sf.ehcache.constructs.EhcacheDecoratorAdapter
      extended by net.sf.ehcache.constructs.blocking.BlockingCache
          extended by net.sf.ehcache.constructs.blocking.SelfPopulatingCache
              extended by com.googlecode.ehcache.annotations.RefreshingSelfPopulatingCache
All Implemented Interfaces:
java.lang.Cloneable, Ehcache

public class RefreshingSelfPopulatingCache
extends SelfPopulatingCache

Extension of SelfPopulatingCache that schedules a periodic call of SelfPopulatingCache.refresh() via the specified TaskSchedulerAdapter. Also overrides refreshElement(Element, Ehcache, boolean) to allow for asynchronous refresh of elements iff an Executor was provided to the constructor.


Field Summary
protected  org.slf4j.Logger logger
           
 
Fields inherited from class net.sf.ehcache.constructs.blocking.SelfPopulatingCache
factory
 
Fields inherited from class net.sf.ehcache.constructs.blocking.BlockingCache
timeoutMillis
 
Fields inherited from class net.sf.ehcache.constructs.EhcacheDecoratorAdapter
underlyingCache
 
Constructor Summary
RefreshingSelfPopulatingCache(Ehcache cache, CacheEntryFactory cacheEntryFactory, TaskSchedulerAdapter scheduler, TaskExecutor executer, long refreshInterval)
           
 
Method Summary
 long getRefreshInterval()
           
protected  Element refreshElement(Element element, Ehcache backingCache, boolean quiet)
           
protected  void scheduleRefreshTask()
           
 
Methods inherited from class net.sf.ehcache.constructs.blocking.SelfPopulatingCache
get, makeAndCheckElement, refresh, refresh, refresh, refresh, refreshElement
 
Methods inherited from class net.sf.ehcache.constructs.blocking.BlockingCache
get, getAllWithLoader, getCache, getLockForKey, getTimeoutMillis, getWithLoader, liveness, load, loadAll, put, registerCacheLoader, setTimeoutMillis, unregisterCacheLoader
 
Methods inherited from class net.sf.ehcache.constructs.EhcacheDecoratorAdapter
acquireReadLockOnKey, acquireWriteLockOnKey, addPropertyChangeListener, bootstrap, calculateInMemorySize, calculateOffHeapSize, clearStatistics, clone, createQuery, disableDynamicFeatures, dispose, evictExpiredElements, flush, getAverageGetTime, getAverageSearchTime, getBootstrapCacheLoader, getCacheConfiguration, getCacheEventNotificationService, getCacheExceptionHandler, getCacheManager, getDiskStoreSize, getGuid, getInternalContext, getKeys, getKeysNoDuplicateCheck, getKeysWithExpiryCheck, getLiveCacheStatistics, getMemoryStoreSize, getName, getOffHeapStoreSize, getQuiet, getQuiet, getRegisteredCacheExtensions, getRegisteredCacheLoaders, getRegisteredCacheWriter, getSampledCacheStatistics, getSearchAttribute, getSearchesPerSecond, getSize, getSizeBasedOnAccuracy, getStatistics, getStatisticsAccuracy, getStatus, getWriterManager, initialise, isClusterBulkLoadEnabled, isClusterCoherent, isDisabled, isElementInMemory, isElementInMemory, isElementOnDisk, isElementOnDisk, isExpired, isKeyInCache, isNodeBulkLoadEnabled, isNodeCoherent, isReadLockedByCurrentThread, isSampledStatisticsEnabled, isSearchable, isStatisticsEnabled, isValueInCache, isWriteLockedByCurrentThread, put, putIfAbsent, putQuiet, putWithWriter, registerCacheExtension, registerCacheUsageListener, registerCacheWriter, releaseReadLockOnKey, releaseWriteLockOnKey, remove, remove, remove, remove, removeAll, removeAll, removeCacheUsageListener, removeElement, removePropertyChangeListener, removeQuiet, removeQuiet, removeWithWriter, replace, replace, setBootstrapCacheLoader, setCacheExceptionHandler, setCacheManager, setDisabled, setDiskStorePath, setName, setNodeBulkLoadEnabled, setNodeCoherent, setSampledStatisticsEnabled, setStatisticsAccuracy, setStatisticsEnabled, setTransactionManagerLookup, toString, tryReadLockOnKey, tryWriteLockOnKey, unregisterCacheExtension, unregisterCacheWriter, waitUntilClusterBulkLoadComplete, waitUntilClusterCoherent
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected final org.slf4j.Logger logger
Constructor Detail

RefreshingSelfPopulatingCache

public RefreshingSelfPopulatingCache(Ehcache cache,
                                     CacheEntryFactory cacheEntryFactory,
                                     TaskSchedulerAdapter scheduler,
                                     TaskExecutor executer,
                                     long refreshInterval)
Method Detail

getRefreshInterval

public long getRefreshInterval()

scheduleRefreshTask

protected void scheduleRefreshTask()

refreshElement

protected Element refreshElement(Element element,
                                 Ehcache backingCache,
                                 boolean quiet)
                          throws java.lang.Exception
Overrides:
refreshElement in class SelfPopulatingCache
Throws:
java.lang.Exception


Copyright © 2011. All Rights Reserved.