Class DefaultCacheRegion
java.lang.Object
de.hybris.platform.regioncache.region.impl.DefaultCacheRegion
- All Implemented Interfaces:
CacheRegion
Default cache region implementation.
For the synchronization it uses ReentrantReadWriteLock one for whole cache map. It is really inefficient then.
For the synchronization it uses ReentrantReadWriteLock one for whole cache map. It is really inefficient then.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CacheMapprotected final booleanprotected String[]protected CacheLifecycleCallbackprotected final Stringprotected final ReentrantReadWriteLockprotected final CacheStatisticsprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionDefaultCacheRegion(String name) DefaultCacheRegion(String name, boolean exclusiveComputation, boolean statsEnabled) DefaultCacheRegion(String name, int maxEntries) DefaultCacheRegion(String name, int maxEntries, boolean exclusiveComputation, boolean statsEnabled) DefaultCacheRegion(String name, int maxEntries, boolean exclusiveComputation, String evictionPolicy, boolean statsEnabled) Deprecated, for removal: This API element is subject to removal in a future version.since 1811DefaultCacheRegion(String name, CacheMap cacheMap, CacheStatistics stats, String[] handledTypes) DefaultCacheRegion(String name, CacheMap cacheMap, CacheStatistics stats, String[] handledTypes, boolean exclusiveComputation, boolean statsEnabled) DefaultCacheRegion(String name, CacheMap cacheMap, String[] handledTypes) -
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves all elements from cache.booleancontainsKey(CacheKey key) Checks if key is in the cache map.booleanGets value from the cache.Returns all keys currently stored in this region.longGets number of cache entries above which invalidation occurs.Gets statistics for current region.String[]Gets types which can be stored in the region.longReturns number of elements currently in the cachegetName()Gets region name.getWithLoader(CacheKey key, CacheValueLoader loader) Gets value from cache.inthashCode()voidinit()invalidate(CacheKey key, boolean fireEventsEvenIfNotRemoved) Invalidates (removes) value from cache map.booleanvoidThis callback shall be called when eviction occurs.Removes value stored on the key specified.voidsetCacheMap(CacheMap cacheMap) voidsetHandledTypes(String[] handledTypes) voidsetStatsEnabled(boolean enabled) toString()
-
Field Details
-
cacheMap
-
handledTypes
-
lifecycleCallback
-
name
-
stats
-
statsEnabled
protected volatile boolean statsEnabled -
exclusiveComputation
protected final boolean exclusiveComputation
-
-
Constructor Details
-
DefaultCacheRegion
-
DefaultCacheRegion
-
DefaultCacheRegion
-
DefaultCacheRegion
public DefaultCacheRegion(String name, CacheMap cacheMap, CacheStatistics stats, String[] handledTypes) -
DefaultCacheRegion
public DefaultCacheRegion(String name, CacheMap cacheMap, CacheStatistics stats, String[] handledTypes, boolean exclusiveComputation, boolean statsEnabled) -
DefaultCacheRegion
public DefaultCacheRegion(String name, int maxEntries, boolean exclusiveComputation, boolean statsEnabled) -
DefaultCacheRegion
@Deprecated(since="1811", forRemoval=true) public DefaultCacheRegion(String name, int maxEntries, boolean exclusiveComputation, String evictionPolicy, boolean statsEnabled) Deprecated, for removal: This API element is subject to removal in a future version.since 1811- Parameters:
evictionPolicy-
-
DefaultCacheRegion
-
-
Method Details
-
init
@PostConstruct public void init() -
get
Description copied from interface:CacheRegionGets value from the cache. If value is absent returns null. Must be thread safe.- Specified by:
getin interfaceCacheRegion
-
getMaxReachedSize
public long getMaxReachedSize()Description copied from interface:CacheRegionReturns number of elements currently in the cache- Specified by:
getMaxReachedSizein interfaceCacheRegion
-
getWithLoader
Description copied from interface:CacheRegionGets value from cache. Invokes loader if necessary. Must be thread safe.- Specified by:
getWithLoaderin interfaceCacheRegion- Throws:
CacheValueLoadException
-
invalidate
Description copied from interface:CacheRegionInvalidates (removes) value from cache map. Must be thread safe.- Specified by:
invalidatein interfaceCacheRegion- Returns:
- an object invalidated from cache.
-
getName
Description copied from interface:CacheRegionGets region name. Needed to resolve proper cache region.- Specified by:
getNamein interfaceCacheRegion
-
getHandledTypes
Description copied from interface:CacheRegionGets types which can be stored in the region. Needed to resolve proper cache region.
Special type names are defined inRegionType.- Specified by:
getHandledTypesin interfaceCacheRegion
-
setHandledTypes
-
getCacheMap
- Returns:
- the cacheMap
-
setCacheMap
- Parameters:
cacheMap- the cacheMap to set
-
hashCode
public int hashCode() -
equals
-
getCacheRegionStatistics
Description copied from interface:CacheRegionGets statistics for current region.- Specified by:
getCacheRegionStatisticsin interfaceCacheRegion
-
getCacheMaxEntries
public long getCacheMaxEntries()Description copied from interface:CacheRegionGets number of cache entries above which invalidation occurs.- Specified by:
getCacheMaxEntriesin interfaceCacheRegion
-
clearCache
public void clearCache()Description copied from interface:CacheRegionRemoves all elements from cache.- Specified by:
clearCachein interfaceCacheRegion
-
registerLifecycleCallback
Description copied from interface:CacheRegionThis callback shall be called when eviction occurs.- Specified by:
registerLifecycleCallbackin interfaceCacheRegion
-
toString
-
getAllKeys
Description copied from interface:CacheRegionReturns all keys currently stored in this region.- Specified by:
getAllKeysin interfaceCacheRegion
-
remove
Description copied from interface:CacheRegionRemoves value stored on the key specified. This method does not update statistics. Returns value removed or null.- Specified by:
removein interfaceCacheRegion
-
containsKey
Description copied from interface:CacheRegionChecks if key is in the cache map.- Specified by:
containsKeyin interfaceCacheRegion
-
setStatsEnabled
public void setStatsEnabled(boolean enabled) - Specified by:
setStatsEnabledin interfaceCacheRegion
-
isStatsEnabled
public boolean isStatsEnabled()- Specified by:
isStatsEnabledin interfaceCacheRegion
-