Package de.hybris.platform.cache
Interface Cache
- All Superinterfaces:
InvalidationTarget
- All Known Implementing Classes:
DefaultCache,RegionCacheAdapter
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final booleanstatic final int -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()voidClears the collected cache statistics.voiddestroy()Method called by tennant to free resources before object is finalizedvoidenableStats(boolean enabled) getAbstractCacheUnit(String firstKeyElement, String secondKeyElement, String thirdKeyElement, PK fourthKeyElement) for performance optimizations: get a existing cache unit; the key of the cache unit must consist of exactly three elementslonglongintThe upper limit for the cache.intthe maximum reached number of entries since creation of the cache.longgets value stored in the cache or loads it.
Throws exception wrapped into RuntimeExceptionlong<T> TgetRequestCacheContent(SingletonCreator.Creator<T> creator) <T> TintgetSize()<T> TgetStaticCacheContent(SingletonCreator.Creator<T> creator) Set<? extends CacheStatisticsEntry>getStatistics(int upperBound, int lowerBound) Returns asSetthe collected cache statistics.get the tenant this cache is created for.getUnit(AbstractCacheUnit unit) voidinvalidate(Object[] key, int invalidationType) execute invalidation (not delayed to transaction end)booleanchecks if AbstractCacheUnit should synchronize load function.booleanReturnstrueif no cache statistics are collected.voidremoveUnit(AbstractCacheUnit unit) Removes a cache unit from this cache.voidsetEnabled(boolean enabled) enables/disables the cache.voidsetStatsEnabled(boolean enabled) Enables or disables the cache statistics.booleanReturnstrueif the statistics for the cache are enabled.
-
Field Details
-
CACHEKEY_HJMP
-
CACHEKEY_ENTITY
-
CACHEKEY_FIND
-
CACHEKEY_FLEXSEARCH
-
CACHEKEY_ENTITYISALIVE
-
CACHEKEY_JALOITEMDATA
-
CACHEKEY_JALOTYPE
-
CACHEKEY_JALOITEMCACHE
-
CACHEKEY_CUSTOM
-
CACHEKEY_C2LMANAGER
-
CONFIG_CACHE_MAIN
- See Also:
-
CONFIG_CACHE_SHARED
- See Also:
-
DEFAULT_CACHE_SHARED
static final boolean DEFAULT_CACHE_SHARED- See Also:
-
DEFAULT_CACHE_MAIN
static final int DEFAULT_CACHE_MAIN- See Also:
-
LIMIT_CACHE_MAIN
static final int LIMIT_CACHE_MAIN- See Also:
-
CONFIG_CONCURRENCY_LEVEL
- See Also:
-
CONFIG_EVICTION_POLICY
- See Also:
-
CONFIG_FORCE_EXCLUSIVE_CALCULATION
- See Also:
-
-
Method Details
-
setEnabled
void setEnabled(boolean enabled) enables/disables the cache.- Parameters:
enabled-truefor enabling the cache,falseotherwise.
-
getOrAddUnit
gets value stored in the cache or loads it.
Throws exception wrapped into RuntimeException -
getUnit
- Returns:
- null if no unit with the given key is in the cache
- Throws:
CacheRegionNotSpecifiedException
-
isForceExclusiveComputation
boolean isForceExclusiveComputation()checks if AbstractCacheUnit should synchronize load function. -
clear
void clear() -
removeUnit
Removes a cache unit from this cache.- Parameters:
unit- the unit to be removed. note that the same of any unit with the same key is removed.
-
invalidate
execute invalidation (not delayed to transaction end)- Specified by:
invalidatein interfaceInvalidationTarget- Parameters:
key- may be an incomplete key, for group invalidation
-
getAbstractCacheUnit
AbstractCacheUnit getAbstractCacheUnit(String firstKeyElement, String secondKeyElement, String thirdKeyElement, PK fourthKeyElement) for performance optimizations: get a existing cache unit; the key of the cache unit must consist of exactly three elements -
clearStats
void clearStats()Clears the collected cache statistics. -
statsEnabled
boolean statsEnabled()Returnstrueif the statistics for the cache are enabled. This can be modified with the methodsetStatsEnabled(boolean). Collecting the statistics is very memory intensive - useclearStats()frequently.- Returns:
falseotherwise.
-
setStatsEnabled
void setStatsEnabled(boolean enabled) Enables or disables the cache statistics.- Parameters:
enabled-truefor enabling the statistics
-
enableStats
void enableStats(boolean enabled) -
isStatsEmpty
boolean isStatsEmpty()Returnstrueif no cache statistics are collected. addToStatistics(Object[], boolean) was not called yet)- Returns:
falseotherwise
-
getStatistics
Returns asSetthe collected cache statistics. Each set entry is aDefaultCacheStatisticsEntry. With the parametersupperBoundandlowerBounda reduced Set will be returned.DefaultCacheStatisticsEntry.getFactor()must be betweenupperBoundandlowerBound.- Parameters:
upperBound- the upper bound for the returned set. Each entry factor is equal or less.lowerBound- the lower bound the the returned set. Each entry factor is greater or equal.- Returns:
- a Set with
DefaultCacheStatisticsEntry.
-
getMaxAllowedSize
int getMaxAllowedSize()The upper limit for the cache. this normally equals the setting 'cache.main' and is the number of cache entries that are allowed until the cache mechanism will remove the least recently used entries before adding new ones.- Returns:
- the max allowed size
-
getMaxReachedSize
int getMaxReachedSize()the maximum reached number of entries since creation of the cache. this is only reseted if Cache#clearCache() is called. -
getSize
int getSize() -
getAddCount
long getAddCount()- Returns:
- how many entities where added to the cache since creation of the cache. This is reseted by calling
clear()orclearStats().
-
getRemoveCount
long getRemoveCount()- Returns:
- how many entities where removed from the cache since creation of the cache. This is reseted by calling
clear()orclearStats().
-
getGetCount
long getGetCount()- Returns:
- how many entities where requested from the cache since creation of the cache. This is reseted by calling
clear()orclearStats().
-
getMissCount
long getMissCount()- Returns:
- how many entities where requested from the cache but wasn't in the cache (yet) since creation of the
cache. This is reseted by calling
clear()orclearStats().
-
destroy
void destroy()Method called by tennant to free resources before object is finalized -
getTenant
Tenant getTenant()get the tenant this cache is created for. The hybris 'internal' cache (Tenant.getCache()always has a tenant, but it is possible to create your own Cache without assigning to a tenant.- Returns:
- the tenant or null if no tenant set
-
getTenantId
String getTenantId() -
getStaticCacheContent
-
getRequestCacheContent
-
getRequestCacheContentIfExists
-