Top Description Fields Constructors Methods
net.sf.ehcache.constructs.readthrough

public Class ReadThroughCache

extends EhcacheDecoratorAdapter
Class Inheritance
Imports
java.io.Serializable, net.sf.ehcache.Cache, .CacheException, .Ehcache, .Element, net.sf.ehcache.constructs.EhcacheDecoratorAdapter

This class implements the simplest of all possible read through cache behaviors, where a call the get() will delegate to a call to getWithLoader(). This means that a get() call can take a long time; beware. It also does no more locking than Cache implements; each separate cache may try to load a key at the same time.
Author
cschanck

Field Summary

Modifier and TypeField and Description
private final boolean
private final ReadThroughCacheConfiguration
Inherited from net.sf.ehcache.constructs.EhcacheDecoratorAdapter:
underlyingCache

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Element
get(Object
an Object value
key
)

Overrides net.sf.ehcache.constructs.EhcacheDecoratorAdapter.get.

Implements net.sf.ehcache.Ehcache.get.

Gets an element from the cache.
public Element
get(Serializable
a serializable value
key
)

Overrides net.sf.ehcache.constructs.EhcacheDecoratorAdapter.get.

Implements net.sf.ehcache.Ehcache.get.

Gets an element from the cache.
public String
Inherited from net.sf.ehcache.constructs.EhcacheDecoratorAdapter:
acquireReadLockOnKeyacquireWriteLockOnKeyaddPropertyChangeListenerbootstrapcalculateInMemorySizecalculateOffHeapSizecalculateOnDiskSizeclonecreateQuerydisableDynamicFeaturesdisposeevictExpiredElementsflushgetAllgetAllWithLoadergetBootstrapCacheLoadergetCacheConfigurationgetCacheEventNotificationServicegetCacheExceptionHandlergetCacheManagergetDiskStoreSizegetGuidgetInternalContextgetKeysgetKeysNoDuplicateCheckgetKeysWithExpiryCheckgetMemoryStoreSizegetOffHeapStoreSizegetQuietgetQuietgetRegisteredCacheExtensionsgetRegisteredCacheLoadersgetRegisteredCacheWritergetSearchAttributegetSearchAttributesgetSizegetStatisticsgetStatusgetWithLoadergetWriterManagerhasAbortedSizeOfinitialiseisClusterBulkLoadEnabledisClusterCoherentisDisabledisElementInMemoryisElementInMemoryisElementOnDiskisElementOnDiskisExpiredisKeyInCacheisNodeBulkLoadEnabledisNodeCoherentisReadLockedByCurrentThreadisSearchableisValueInCacheisWriteLockedByCurrentThreadloadloadAllputputputAllputIfAbsentputIfAbsentputQuietputWithWriterrecalculateSizeregisterCacheExtensionregisterCacheLoaderregisterCacheWriterregisterDynamicAttributesExtractorreleaseReadLockOnKeyreleaseWriteLockOnKeyremoveremoveremoveremoveremoveAllremoveAllremoveAllremoveAllremoveAndReturnElementremoveElementremovePropertyChangeListenerremoveQuietremoveQuietremoveWithWriterreplacereplacesetBootstrapCacheLoadersetCacheExceptionHandlersetCacheManagersetDisabledsetNamesetNodeBulkLoadEnabledsetNodeCoherentsetTransactionManagerLookuptoStringtryReadLockOnKeytryWriteLockOnKeyunregisterCacheExtensionunregisterCacheLoaderunregisterCacheWriterwaitUntilClusterBulkLoadCompletewaitUntilClusterCoherent

Field Detail

isModeGetback to summary
private final boolean isModeGet
readThroughCacheConfigback to summary
private final ReadThroughCacheConfiguration readThroughCacheConfig

Constructor Detail

ReadThroughCacheback to summary
public ReadThroughCache(Ehcache underlyingCache, ReadThroughCacheConfiguration config)

Method Detail

getback to summary
public Element get(Object key) throws IllegalStateException, CacheException

Overrides net.sf.ehcache.constructs.EhcacheDecoratorAdapter.get.

Implements net.sf.ehcache.Ehcache.get.

Doc from net.sf.ehcache.constructs.EhcacheDecoratorAdapter.get.

Gets an element from the cache. Updates Element Statistics

Note that the Element's lastAccessTime is always the time of this get. Use getQuiet(Object) to peek into the Element to see its last access time with get

Parameters
key:Object

Doc from net.sf.ehcache.Ehcache.get.

an Object value

Returns:Element

Doc from net.sf.ehcache.Ehcache.get.

the element, or null, if it does not exist.

Annotations
@Override
Exceptions
IllegalStateException:

Doc from net.sf.ehcache.Ehcache.get.

if the cache is not net.sf.ehcache.Status#STATUS_ALIVE

getback to summary
public Element get(Serializable key) throws IllegalStateException, CacheException

Overrides net.sf.ehcache.constructs.EhcacheDecoratorAdapter.get.

Implements net.sf.ehcache.Ehcache.get.

Doc from net.sf.ehcache.constructs.EhcacheDecoratorAdapter.get.

Gets an element from the cache. Updates Element Statistics

Note that the Element's lastAccessTime is always the time of this get. Use getQuiet(Object) to peak into the Element to see its last access time with get

Parameters
key:Serializable

Doc from net.sf.ehcache.Ehcache.get.

a serializable value

Returns:Element

Doc from net.sf.ehcache.Ehcache.get.

the element, or null, if it does not exist.

Annotations
@Override
Exceptions
IllegalStateException:

Doc from net.sf.ehcache.Ehcache.get.

if the cache is not net.sf.ehcache.Status#STATUS_ALIVE

getNameback to summary
public String getName()

Overrides net.sf.ehcache.constructs.EhcacheDecoratorAdapter.getName.

Implements net.sf.ehcache.Ehcache.getName.

Doc from net.sf.ehcache.constructs.EhcacheDecoratorAdapter.getName.

Gets the cache name.

Returns:String

Doc from net.sf.ehcache.Ehcache.getName.

the name

Annotations
@Override