public interface Cache extends InvalidationTarget
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CACHEKEY_C2LMANAGER |
static java.lang.String |
CACHEKEY_CUSTOM |
static java.lang.String |
CACHEKEY_ENTITY |
static java.lang.String |
CACHEKEY_ENTITYISALIVE |
static java.lang.String |
CACHEKEY_FIND |
static java.lang.String |
CACHEKEY_FLEXSEARCH |
static java.lang.String |
CACHEKEY_HJMP |
static java.lang.String |
CACHEKEY_JALOITEMCACHE |
static java.lang.String |
CACHEKEY_JALOITEMDATA |
static java.lang.String |
CACHEKEY_JALOTYPE |
static java.lang.String |
CONFIG_CACHE_MAIN |
static java.lang.String |
CONFIG_CACHE_SHARED |
static java.lang.String |
CONFIG_CONCURRENCY_LEVEL |
static java.lang.String |
CONFIG_EVICTION_POLICY |
static java.lang.String |
CONFIG_FORCE_EXCLUSIVE_CALCULATION |
static int |
DEFAULT_CACHE_MAIN |
static boolean |
DEFAULT_CACHE_SHARED |
static int |
LIMIT_CACHE_MAIN |
| 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) |
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()
The upper limit for the cache.
|
int |
getMaxReachedSize()
the maximum reached number of entries since creation of the cache.
|
long |
getMissCount() |
AbstractCacheUnit |
getOrAddUnit(AbstractCacheUnit unit)
gets value stored in the cache or loads it.
Throws exception wrapped into RuntimeException |
long |
getRemoveCount() |
<T> T |
getRequestCacheContent(SingletonCreator.Creator<T> creator) |
<T> T |
getRequestCacheContentIfExists(SingletonCreator.Creator<T> creator) |
int |
getSize() |
<T> T |
getStaticCacheContent(SingletonCreator.Creator<T> creator) |
java.util.Set<? extends CacheStatisticsEntry> |
getStatistics(int upperBound,
int lowerBound)
Returns as
Set the collected cache statistics. |
Tenant |
getTenant()
get the tenant this cache is created for.
|
java.lang.String |
getTenantId() |
AbstractCacheUnit |
getUnit(AbstractCacheUnit unit) |
void |
invalidate(java.lang.Object[] key,
int invalidationType)
execute invalidation (not delayed to transaction end)
|
boolean |
isForceExclusiveComputation()
checks if AbstractCacheUnit should synchronize load function.
|
boolean |
isStatsEmpty()
Returns
true if no cache statistics are collected. |
void |
removeUnit(AbstractCacheUnit unit)
Removes a cache unit from this cache.
|
void |
setEnabled(boolean enabled)
enables/disables the cache.
|
void |
setStatsEnabled(boolean enabled)
Enables or disables the cache statistics.
|
boolean |
statsEnabled()
Returns
true if the statistics for the cache are enabled. |
static final java.lang.String CACHEKEY_HJMP
static final java.lang.String CACHEKEY_ENTITY
static final java.lang.String CACHEKEY_FIND
static final java.lang.String CACHEKEY_FLEXSEARCH
static final java.lang.String CACHEKEY_ENTITYISALIVE
static final java.lang.String CACHEKEY_JALOITEMDATA
static final java.lang.String CACHEKEY_JALOTYPE
static final java.lang.String CACHEKEY_JALOITEMCACHE
static final java.lang.String CACHEKEY_CUSTOM
static final java.lang.String CACHEKEY_C2LMANAGER
static final java.lang.String CONFIG_CACHE_MAIN
static final java.lang.String CONFIG_CACHE_SHARED
static final boolean DEFAULT_CACHE_SHARED
static final int DEFAULT_CACHE_MAIN
static final int LIMIT_CACHE_MAIN
static final java.lang.String CONFIG_CONCURRENCY_LEVEL
static final java.lang.String CONFIG_EVICTION_POLICY
static final java.lang.String CONFIG_FORCE_EXCLUSIVE_CALCULATION
void setEnabled(boolean enabled)
enabled - true for enabling the cache, false otherwise.AbstractCacheUnit getOrAddUnit(AbstractCacheUnit unit)
AbstractCacheUnit getUnit(AbstractCacheUnit unit)
CacheRegionNotSpecifiedExceptionboolean isForceExclusiveComputation()
void clear()
void removeUnit(AbstractCacheUnit unit)
unit - the unit to be removed. note that the same of any unit with the same key is removed.void invalidate(java.lang.Object[] key,
int invalidationType)
invalidate in interface InvalidationTargetkey - may be an incomplete key, for group invalidationAbstractCacheUnit getAbstractCacheUnit(java.lang.String firstKeyElement, java.lang.String secondKeyElement, java.lang.String thirdKeyElement, PK fourthKeyElement)
void clearStats()
boolean statsEnabled()
true if the statistics for the cache are enabled. This can be modified with the method
setStatsEnabled(boolean). Collecting the statistics is very memory intensive - use clearStats()
frequently.false otherwise.void setStatsEnabled(boolean enabled)
enabled - true for enabling the statisticsvoid enableStats(boolean enabled)
boolean isStatsEmpty()
true if no cache statistics are collected. addToStatistics(Object[], boolean) was not called
yet)false otherwisejava.util.Set<? extends CacheStatisticsEntry> getStatistics(int upperBound, int lowerBound)
Set the collected cache statistics. Each set entry is a DefaultCacheStatisticsEntry.
With the parameters upperBound and lowerBound a reduced Set will be returned.
DefaultCacheStatisticsEntry.getFactor() must be between upperBound and
lowerBound.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.DefaultCacheStatisticsEntry.int getMaxAllowedSize()
int getMaxReachedSize()
int getSize()
long getAddCount()
clear() or clearStats().long getRemoveCount()
clear() or clearStats().long getGetCount()
clear() or clearStats().long getMissCount()
clear() or clearStats().void destroy()
Tenant getTenant()
Tenant.getCache() always has a
tenant, but it is possible to create your own Cache without assigning to a tenant.java.lang.String getTenantId()
<T> T getStaticCacheContent(SingletonCreator.Creator<T> creator)
<T> T getRequestCacheContent(SingletonCreator.Creator<T> creator)
<T> T getRequestCacheContentIfExists(SingletonCreator.Creator<T> creator)
Copyright © 2018 SAP SE. All Rights Reserved.