public class DefaultCacheRegion extends Object implements CacheRegion
| Modifier and Type | Field and Description |
|---|---|
protected CacheMap |
cacheMap |
protected boolean |
exclusiveComputation |
protected String[] |
handledTypes |
protected CacheLifecycleCallback |
lifecycleCallback |
protected String |
name |
protected ReentrantReadWriteLock |
sharedLock |
protected CacheStatistics |
stats |
protected boolean |
statsEnabled |
| Constructor and Description |
|---|
DefaultCacheRegion(String name) |
DefaultCacheRegion(String name,
boolean exclusiveComputation,
boolean statsEnabled) |
DefaultCacheRegion(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) |
DefaultCacheRegion(String name,
int maxEntries) |
DefaultCacheRegion(String name,
int maxEntries,
boolean exclusiveComputation,
String evictionPolicy,
boolean statsEnabled) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearCache()
Removes all elements from cache.
|
boolean |
containsKey(CacheKey key)
Checks if key is in the cache map.
|
boolean |
equals(Object obj) |
Object |
get(CacheKey key)
Gets value from the cache.
|
Collection<CacheKey> |
getAllKeys()
Returns all keys currently stored in this region.
|
CacheMap |
getCacheMap() |
long |
getCacheMaxEntries()
Gets number of cache entries above which invalidation occurs.
|
CacheStatistics |
getCacheRegionStatistics()
Gets statistics for current region.
|
String[] |
getHandledTypes()
Gets types which can be stored in the region.
|
long |
getMaxReachedSize()
Returns number of elements currently in the cache
|
String |
getName()
Gets region name.
|
Object |
getWithLoader(CacheKey key,
CacheValueLoader loader)
Gets value from cache.
|
int |
hashCode() |
void |
init() |
Object |
invalidate(CacheKey key,
boolean fireEventsEvenIfNotRemoved)
Invalidates (removes) value from cache map.
|
boolean |
isStatsEnabled() |
void |
registerLifecycleCallback(CacheLifecycleCallback callback)
This callback shall be called when eviction occurs.
|
Object |
remove(CacheKey key,
boolean fireEvents)
Removes value stored on the key specified.
|
void |
setCacheMap(CacheMap cacheMap) |
void |
setHandledTypes(String[] handledTypes) |
void |
setStatsEnabled(boolean enabled) |
String |
toString() |
protected CacheMap cacheMap
protected String[] handledTypes
protected CacheLifecycleCallback lifecycleCallback
protected final String name
protected final CacheStatistics stats
protected final ReentrantReadWriteLock sharedLock
protected volatile boolean statsEnabled
protected final boolean exclusiveComputation
public DefaultCacheRegion(String name)
public DefaultCacheRegion(String name, boolean exclusiveComputation, boolean statsEnabled)
public DefaultCacheRegion(String name, CacheMap cacheMap, CacheStatistics stats, String[] handledTypes)
public DefaultCacheRegion(String name, CacheMap cacheMap, CacheStatistics stats, String[] handledTypes, boolean exclusiveComputation, boolean statsEnabled)
public DefaultCacheRegion(String name, int maxEntries, boolean exclusiveComputation, String evictionPolicy, boolean statsEnabled)
evictionPolicy - public DefaultCacheRegion(String name, int maxEntries)
@PostConstruct public void init()
public Object get(CacheKey key)
CacheRegionget in interface CacheRegionpublic long getMaxReachedSize()
CacheRegiongetMaxReachedSize in interface CacheRegionpublic Object getWithLoader(CacheKey key, CacheValueLoader loader) throws CacheValueLoadException
CacheRegiongetWithLoader in interface CacheRegionCacheValueLoadExceptionpublic Object invalidate(CacheKey key, boolean fireEventsEvenIfNotRemoved)
CacheRegioninvalidate in interface CacheRegionpublic String getName()
CacheRegiongetName in interface CacheRegionpublic String[] getHandledTypes()
CacheRegionRegionType.getHandledTypes in interface CacheRegionpublic void setHandledTypes(String[] handledTypes)
public CacheMap getCacheMap()
public void setCacheMap(CacheMap cacheMap)
cacheMap - the cacheMap to setpublic CacheStatistics getCacheRegionStatistics()
CacheRegiongetCacheRegionStatistics in interface CacheRegionpublic long getCacheMaxEntries()
CacheRegiongetCacheMaxEntries in interface CacheRegionpublic void clearCache()
CacheRegionclearCache in interface CacheRegionpublic void registerLifecycleCallback(CacheLifecycleCallback callback)
CacheRegionregisterLifecycleCallback in interface CacheRegionpublic Collection<CacheKey> getAllKeys()
CacheRegiongetAllKeys in interface CacheRegionpublic Object remove(CacheKey key, boolean fireEvents)
CacheRegionremove in interface CacheRegionpublic boolean containsKey(CacheKey key)
CacheRegioncontainsKey in interface CacheRegionpublic void setStatsEnabled(boolean enabled)
setStatsEnabled in interface CacheRegionpublic boolean isStatsEnabled()
isStatsEnabled in interface CacheRegionCopyright © 2017 SAP SE. All Rights Reserved.