K - the cache's key typeV - the cache's value typepublic class LoadingCache<K,V>
extends net.sf.ehcache.constructs.blocking.BlockingCache
SelfPopulatingCache with stronger concurrency guarantees.
We don't lock on loadValueAndReleaseLock(Object), instead we put a flag for each loading operation.
If a remove(Object) operation happens during load operation and before putting the value in to the cache,
newly loaded value will not be put into the cache and only returned to the caller.
Subsequent calls with the same key will trigger a new load operation thus ensuring eventual consistency.
We only lock for actually putting the value into the cache, not loading.BlockingCache,
SynchronizedLoadingCacheDecorator| Constructor and Description |
|---|
LoadingCache(SynchronizedLoadingCacheDecorator cache,
CacheLoader<K,V> loader) |
| Modifier and Type | Method and Description |
|---|---|
net.sf.ehcache.Element |
get(Object key) |
boolean |
remove(Object key) |
boolean |
remove(Object key,
boolean doNotNotifyCacheReplicators) |
boolean |
remove(Serializable key) |
boolean |
remove(Serializable key,
boolean doNotNotifyCacheReplicators) |
void |
removeAll() |
void |
removeAll(boolean doNotNotifyCacheReplicators) |
void |
removeAll(Collection<?> keys) |
void |
removeAll(Collection<?> keys,
boolean doNotNotifyCacheReplicators) |
get, getAllWithLoader, getCache, getLockForKey, getTimeoutMillis, getWithLoader, liveness, load, loadAll, put, put, putIfAbsent, putIfAbsent, putQuiet, putWithWriter, registerCacheLoader, setTimeoutMillis, unregisterCacheLoaderacquireReadLockOnKey, acquireWriteLockOnKey, addPropertyChangeListener, bootstrap, calculateInMemorySize, calculateOffHeapSize, calculateOnDiskSize, clone, createQuery, disableDynamicFeatures, dispose, evictExpiredElements, flush, getAll, getBootstrapCacheLoader, getCacheConfiguration, getCacheEventNotificationService, getCacheExceptionHandler, getCacheManager, getDiskStoreSize, getGuid, getInternalContext, getKeys, getKeysNoDuplicateCheck, getKeysWithExpiryCheck, getMemoryStoreSize, getName, getOffHeapStoreSize, getQuiet, getQuiet, getRegisteredCacheExtensions, getRegisteredCacheLoaders, getRegisteredCacheWriter, getSearchAttribute, getSize, getStatistics, getStatus, getWriterManager, hasAbortedSizeOf, initialise, isClusterBulkLoadEnabled, isClusterCoherent, isDisabled, isElementInMemory, isElementInMemory, isElementOnDisk, isElementOnDisk, isExpired, isKeyInCache, isNodeBulkLoadEnabled, isNodeCoherent, isReadLockedByCurrentThread, isSearchable, isValueInCache, isWriteLockedByCurrentThread, putAll, recalculateSize, registerCacheExtension, registerCacheWriter, registerDynamicAttributesExtractor, releaseReadLockOnKey, releaseWriteLockOnKey, removeAndReturnElement, removeElement, removePropertyChangeListener, removeQuiet, removeQuiet, removeWithWriter, replace, replace, setBootstrapCacheLoader, setCacheExceptionHandler, setCacheManager, setDisabled, setName, setNodeBulkLoadEnabled, setNodeCoherent, setTransactionManagerLookup, toString, tryReadLockOnKey, tryWriteLockOnKey, unregisterCacheExtension, unregisterCacheWriter, waitUntilClusterBulkLoadComplete, waitUntilClusterCoherentpublic LoadingCache(SynchronizedLoadingCacheDecorator cache, CacheLoader<K,V> loader) throws net.sf.ehcache.CacheException
net.sf.ehcache.CacheExceptionpublic net.sf.ehcache.Element get(Object key)
get in interface net.sf.ehcache.Ehcacheget in class net.sf.ehcache.constructs.blocking.BlockingCachepublic boolean remove(Serializable key, boolean doNotNotifyCacheReplicators)
remove in interface net.sf.ehcache.Ehcacheremove in class net.sf.ehcache.constructs.EhcacheDecoratorAdapterpublic boolean remove(Serializable key)
remove in interface net.sf.ehcache.Ehcacheremove in class net.sf.ehcache.constructs.EhcacheDecoratorAdapterpublic boolean remove(Object key)
remove in interface net.sf.ehcache.Ehcacheremove in class net.sf.ehcache.constructs.EhcacheDecoratorAdapterpublic boolean remove(Object key, boolean doNotNotifyCacheReplicators)
remove in interface net.sf.ehcache.Ehcacheremove in class net.sf.ehcache.constructs.EhcacheDecoratorAdapterpublic void removeAll(Collection<?> keys)
removeAll in interface net.sf.ehcache.EhcacheremoveAll in class net.sf.ehcache.constructs.EhcacheDecoratorAdapterpublic void removeAll(Collection<?> keys, boolean doNotNotifyCacheReplicators)
removeAll in interface net.sf.ehcache.EhcacheremoveAll in class net.sf.ehcache.constructs.EhcacheDecoratorAdapterpublic void removeAll()
removeAll in interface net.sf.ehcache.EhcacheremoveAll in class net.sf.ehcache.constructs.EhcacheDecoratorAdapterpublic void removeAll(boolean doNotNotifyCacheReplicators)
removeAll in interface net.sf.ehcache.EhcacheremoveAll in class net.sf.ehcache.constructs.EhcacheDecoratorAdapterCopyright © 2018 Atlassian. All rights reserved.