public class EHCacheRegion extends java.lang.Object implements CacheRegion
| Modifier and Type | Field and Description |
|---|---|
protected Cache |
cacheMap |
protected CacheLifecycleCallback |
lifecycleCallback |
protected CacheManager |
manager |
protected CacheStatistics |
stats |
| Constructor and Description |
|---|
EHCacheRegion(java.lang.String name,
int maxEntries) |
EHCacheRegion(java.lang.String name,
int maxEntries,
java.lang.String evictionPolicy) |
EHCacheRegion(java.lang.String name,
int maxEntries,
java.lang.String evictionPolicy,
boolean exclusiveComputation,
boolean statsEnabled) |
EHCacheRegion(java.lang.String name,
int maxEntries,
java.lang.String evictionPolicy,
boolean exclusiveComputation,
boolean statsEnabled,
java.lang.Long ttlSeconds)
Constructor that adds possibility to configure TTL seconds for cache elements.
|
| 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.
|
protected CacheConfiguration |
createCacheConfiguration() |
protected CacheEventListener |
createCacheEventListener() |
protected CacheStatistics |
createCacheStatistics() |
void |
destroy()
Method unregisters cache
|
java.lang.Object |
get(CacheKey key)
Gets value from the cache.
|
java.util.Collection<CacheKey> |
getAllKeys()
Returns all keys currently stored in this region.
|
long |
getCacheMaxEntries()
Gets number of cache entries above which invalidation occurs.
|
CacheStatistics |
getCacheRegionStatistics()
Gets statistics for current region.
|
java.lang.String[] |
getHandledTypes()
Gets types which can be stored in the region.
|
long |
getMaxReachedSize()
Returns number of elements currently in the cache
|
java.lang.String |
getName()
Gets region name.
|
java.lang.Object |
getWithLoader(CacheKey key,
CacheValueLoader loader)
Gets value from cache.
|
void |
init() |
java.lang.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.
|
java.lang.Object |
remove(CacheKey key,
boolean fireEvents)
Removes value stored on the key specified.
|
void |
setHandledTypes(java.lang.String[] handledTypes) |
void |
setStatsEnabled(boolean enabled) |
java.lang.String |
toString() |
CacheRegion |
unwrap() |
protected CacheLifecycleCallback lifecycleCallback
protected CacheManager manager
protected Cache cacheMap
protected final CacheStatistics stats
public EHCacheRegion(java.lang.String name,
int maxEntries)
public EHCacheRegion(java.lang.String name,
int maxEntries,
java.lang.String evictionPolicy)
public EHCacheRegion(java.lang.String name,
int maxEntries,
java.lang.String evictionPolicy,
boolean exclusiveComputation,
boolean statsEnabled)
public EHCacheRegion(java.lang.String name,
int maxEntries,
java.lang.String evictionPolicy,
boolean exclusiveComputation,
boolean statsEnabled,
java.lang.Long ttlSeconds)
ttlSeconds - time to live seconds for cache elements (see EHCache docs for information about how this affects cache
operations)public java.lang.String toString()
toString in class java.lang.Objectprotected CacheStatistics createCacheStatistics()
protected CacheConfiguration createCacheConfiguration()
@PostConstruct public void init()
@PreDestroy public void destroy()
protected CacheEventListener createCacheEventListener()
public java.lang.Object get(CacheKey key)
CacheRegionget in interface CacheRegionpublic long getMaxReachedSize()
CacheRegiongetMaxReachedSize in interface CacheRegionpublic java.lang.Object getWithLoader(CacheKey key, CacheValueLoader loader) throws CacheValueLoadException
CacheRegiongetWithLoader in interface CacheRegionCacheValueLoadExceptionpublic java.lang.String getName()
CacheRegiongetName in interface CacheRegionpublic java.lang.String[] getHandledTypes()
CacheRegionRegionType.getHandledTypes in interface CacheRegionpublic CacheStatistics getCacheRegionStatistics()
CacheRegiongetCacheRegionStatistics in interface CacheRegionpublic long getCacheMaxEntries()
CacheRegiongetCacheMaxEntries in interface CacheRegionpublic void registerLifecycleCallback(CacheLifecycleCallback callback)
CacheRegionregisterLifecycleCallback in interface CacheRegionpublic void clearCache()
CacheRegionclearCache in interface CacheRegionpublic java.lang.Object invalidate(CacheKey key, boolean fireEventsEvenIfNotRemoved)
CacheRegioninvalidate in interface CacheRegionpublic java.util.Collection<CacheKey> getAllKeys()
CacheRegiongetAllKeys in interface CacheRegionpublic java.lang.Object remove(CacheKey key, boolean fireEvents)
CacheRegionremove in interface CacheRegionpublic void setHandledTypes(java.lang.String[] handledTypes)
handledTypes - the handledTypes to setpublic boolean containsKey(CacheKey key)
CacheRegioncontainsKey in interface CacheRegionpublic void setStatsEnabled(boolean enabled)
setStatsEnabled in interface CacheRegionpublic boolean isStatsEnabled()
isStatsEnabled in interface CacheRegionpublic CacheRegion unwrap()
Copyright © 2018 SAP SE. All Rights Reserved.