public class RegionCacheAdapter extends StaticCache implements Cache, CacheLifecycleCallback
CACHEKEY_C2LMANAGER, CACHEKEY_CUSTOM, CACHEKEY_ENTITY, CACHEKEY_ENTITYISALIVE, CACHEKEY_FIND, CACHEKEY_FLEXSEARCH, CACHEKEY_HJMP, CACHEKEY_JALOITEMCACHE, CACHEKEY_JALOITEMDATA, CACHEKEY_JALOTYPE, CONFIG_CACHE_MAIN, CONFIG_CACHE_SHARED, CONFIG_CONCURRENCY_LEVEL, CONFIG_EVICTION_POLICY, CONFIG_FORCE_EXCLUSIVE_CALCULATION, DEFAULT_CACHE_MAIN, DEFAULT_CACHE_SHARED, LIMIT_CACHE_MAIN| Constructor and Description |
|---|
RegionCacheAdapter(Tenant tenant,
CacheController controller) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
void |
clearStats()
Clears the collected cache statistics.
|
void |
destroy()
Method called by tennant to free resources before object is finalized
|
void |
enableStats(boolean enabled) |
boolean |
equals(java.lang.Object obj)
For sake of registering only one adapter in controller
|
AbstractCacheUnit |
getAbstractCacheUnit(java.lang.String firstKeyElement,
java.lang.String secondKeyElement,
java.lang.String thirdKeyElement,
PK fourthKeyElement)
for performance optimizations: get a existing cache unit; the key of the cache unit must consist of exactly three
elements
|
long |
getAddCount() |
long |
getGetCount() |
int |
getMaxAllowedSize()
Gets total cache size for all regions.
|
int |
getMaxReachedSize()
the maximum reached number of entries since creation of the cache.
|
long |
getMissCount() |
AbstractCacheUnit |
getOrAddUnit(AbstractCacheUnit unit)
Invokes de.hybris.platform.regioncache.CachegetController().getOrAddUnit()
|
long |
getRemoveCount() |
int |
getSize() |
java.util.Set<? extends CacheStatisticsEntry> |
getStatistics(int upperBound,
int lowerBound)
FIXME: verify
|
Tenant |
getTenant()
get the tenant this cache is created for.
|
java.lang.String |
getTenantId() |
AbstractCacheUnit |
getUnit(AbstractCacheUnit unit) |
int |
hashCode() |
void |
invalidate(java.lang.Object[] key,
int invalidationType)
Invokes de.hybris.platform.regioncache.CachegetController().invalidate()
|
boolean |
isForceExclusiveComputation()
We do not load in AbstractCacheUnit.load() (see its comment).
|
boolean |
isStatsEmpty()
Returns
true if no cache statistics are collected. |
void |
onAfterAdd(CacheKey key,
java.lang.Object value,
CacheRegion region)
Executes after an object has been added to the cache.
|
void |
onAfterEviction(CacheKey key,
java.lang.Object value,
CacheRegion region)
Executes after an object has been evicted from the cache.
|
void |
onAfterRemove(CacheKey key,
java.lang.Object value,
CacheRegion region)
Executes after an object has been removed from the cache.
|
void |
onMissLoad(CacheKey key,
java.lang.Object value,
CacheRegion lruCacheRegion)
Executes after an object has been loaded but not added to the cache.
|
void |
removeUnit(AbstractCacheUnit unit)
Removes value from the cache
|
void |
setEnabled(boolean enabled)
enables/disables the cache.
|
void |
setStatsEnabled(boolean on)
Enables or disables the cache statistics.
|
boolean |
statsEnabled()
Returns
true if the statistics for the cache are enabled. |
java.lang.String |
toString() |
clearRequestCache, clearStaticCache, getRequestCacheContent, getRequestCacheContentIfExists, getRequestCacheMap, getStaticCacheContentclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetRequestCacheContent, getRequestCacheContentIfExists, getStaticCacheContentpublic RegionCacheAdapter(Tenant tenant, CacheController controller)
public int getMaxAllowedSize()
getMaxAllowedSize in interface Cachepublic void invalidate(java.lang.Object[] key,
int invalidationType)
invalidate in interface Cacheinvalidate in interface InvalidationTargetkey - may be an incomplete key, for group invalidationpublic AbstractCacheUnit getOrAddUnit(AbstractCacheUnit unit)
getOrAddUnit in interface Cachepublic void removeUnit(AbstractCacheUnit unit)
removeUnit in interface Cacheunit - the unit to be removed. note that the same of any unit with the same key is removed.public boolean isForceExclusiveComputation()
isForceExclusiveComputation in interface Cachepublic Tenant getTenant()
CacheTenant.getCache() always has a
tenant, but it is possible to create your own Cache without assigning to a tenant.public void setEnabled(boolean enabled)
CachesetEnabled in interface Cacheenabled - true for enabling the cache, false otherwise.public long getAddCount()
getAddCount in interface CacheCache.clear() or Cache.clearStats().public long getRemoveCount()
getRemoveCount in interface CacheCache.clear() or Cache.clearStats().public long getGetCount()
getGetCount in interface CacheCache.clear() or Cache.clearStats().public long getMissCount()
getMissCount in interface CacheCache.clear() or Cache.clearStats().public boolean statsEnabled()
Cachetrue if the statistics for the cache are enabled. This can be modified with the method
Cache.setStatsEnabled(boolean). Collecting the statistics is very memory intensive - use Cache.clearStats()
frequently.statsEnabled in interface Cachefalse otherwise.public void setStatsEnabled(boolean on)
CachesetStatsEnabled in interface Cacheon - true for enabling the statisticspublic void clearStats()
CacheclearStats in interface Cachepublic boolean isStatsEmpty()
Cachetrue if no cache statistics are collected. addToStatistics(Object[], boolean) was not called
yet)isStatsEmpty in interface Cachefalse otherwisepublic int getMaxReachedSize()
CachegetMaxReachedSize in interface Cachepublic AbstractCacheUnit getUnit(AbstractCacheUnit unit) throws CacheRegionNotSpecifiedException
getUnit in interface CacheCacheRegionNotSpecifiedExceptionpublic java.util.Set<? extends CacheStatisticsEntry> getStatistics(int upperBound, int lowerBound)
getStatistics in interface CacheupperBound - 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.DefaultCacheStatisticsEntry.public AbstractCacheUnit getAbstractCacheUnit(java.lang.String firstKeyElement, java.lang.String secondKeyElement, java.lang.String thirdKeyElement, PK fourthKeyElement)
CachegetAbstractCacheUnit in interface Cachepublic java.lang.String getTenantId()
getTenantId in interface Cachepublic void enableStats(boolean enabled)
enableStats in interface Cachepublic void destroy()
Cachepublic void onAfterAdd(CacheKey key, java.lang.Object value, CacheRegion region)
CacheLifecycleCallbackonAfterAdd in interface CacheLifecycleCallbackpublic void onAfterRemove(CacheKey key, java.lang.Object value, CacheRegion region)
CacheLifecycleCallbackonAfterRemove in interface CacheLifecycleCallbackpublic void onAfterEviction(CacheKey key, java.lang.Object value, CacheRegion region)
CacheLifecycleCallbackonAfterEviction in interface CacheLifecycleCallbackpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic void onMissLoad(CacheKey key, java.lang.Object value, CacheRegion lruCacheRegion)
CacheLifecycleCallbackonMissLoad in interface CacheLifecycleCallbackCopyright © 2018 SAP SE. All Rights Reserved.