Class AbstractMapBasedCacheRegion
java.lang.Object
de.hybris.platform.regioncache.region.impl.AbstractMapBasedCacheRegion
- All Implemented Interfaces:
CacheRegion
- Direct Known Subclasses:
LRUCacheRegion,UnlimitedCacheRegion
Abstract class for all map based cache region implementations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String[]protected CacheLifecycleCallbackprotected final Stringprotected final CacheStatisticsprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionAbstractMapBasedCacheRegion(String name, boolean statsEnabled) AbstractMapBasedCacheRegion(String name, CacheStatistics stats, boolean statsEnabled) -
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.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()invalidate(CacheKey key, boolean fireEventsEvenIfNotRemoved) Invalidates (removes) value from cache map.booleanprotected abstract ObjectputIfAbsent(CacheKey key, Object value) voidThis callback shall be called when eviction occurs.Removes value stored on the key specified.voidsetHandledTypes(String[] handledTypes) voidsetStatsEnabled(boolean enabled) toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface de.hybris.platform.regioncache.region.CacheRegion
getCacheMaxEntries
-
Field Details
-
cacheMap
-
handledTypes
-
lifecycleCallback
-
name
-
stats
-
statsEnabled
protected volatile boolean statsEnabled
-
-
Constructor Details
-
AbstractMapBasedCacheRegion
-
AbstractMapBasedCacheRegion
-
-
Method Details
-
setHandledTypes
-
getWithLoader
Description copied from interface:CacheRegionGets value from cache. Invokes loader if necessary. Must be thread safe.- Specified by:
getWithLoaderin interfaceCacheRegion- Throws:
CacheValueLoadException
-
putIfAbsent
-
get
Description copied from interface:CacheRegionGets value from the cache. If value is absent returns null. Must be thread safe.- Specified by:
getin interfaceCacheRegion
-
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
-
getCacheRegionStatistics
Description copied from interface:CacheRegionGets statistics for current region.- Specified by:
getCacheRegionStatisticsin 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
-
getMaxReachedSize
public long getMaxReachedSize()Description copied from interface:CacheRegionReturns number of elements currently in the cache- Specified by:
getMaxReachedSizein interfaceCacheRegion
-
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
-
hashCode
public int hashCode() -
equals
-
toString
-