Interface CacheRegion
-
- All Known Subinterfaces:
UnlimitedCacheRegion
- All Known Implementing Classes:
AbstractMapBasedCacheRegion,CacheAccessImpl,DefaultCacheRegion,EHCacheRegion,FacetSearchConfigCacheRegion,LRUCacheRegion,MediaCacheRegion,MockCacheAccess,ScriptsCacheRegion,UnlimitedCacheRegion
public interface CacheRegionDefines interface for the cache region.
Region is defined on the base of:- region name,
- handled types (by type code). Special "type" descriptions includes:
- _ALL_TYPES: region is handling all possible types available in the platform. One of defined regions MUST be configured to handle all types. If region R1 handles type T and the region R2 handles __ALL_TYPES_ only it is assumed that R2 does not handle T. To make R2 handling type T it should be configured for handling T and _ALL_TYPES_,
- _FlexSearch_: region handles flexible search results.
For region resolve strategy seeCacheRegionResolver.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclearCache()Removes all elements from cache.booleancontainsKey(CacheKey key)Checks if key is in the cache map.java.lang.Objectget(CacheKey key)Gets value from the cache.java.util.Collection<CacheKey>getAllKeys()Returns all keys currently stored in this region.longgetCacheMaxEntries()Gets number of cache entries above which invalidation occurs.CacheStatisticsgetCacheRegionStatistics()Gets statistics for current region.java.lang.String[]getHandledTypes()Gets types which can be stored in the region.longgetMaxReachedSize()Returns number of elements currently in the cachejava.lang.StringgetName()Gets region name.java.lang.ObjectgetWithLoader(CacheKey key, CacheValueLoader loader)Gets value from cache.java.lang.Objectinvalidate(CacheKey key, boolean fireEventsEvenIfNotRemoved)Invalidates (removes) value from cache map.booleanisStatsEnabled()voidregisterLifecycleCallback(CacheLifecycleCallback callback)This callback shall be called when eviction occurs.java.lang.Objectremove(CacheKey key, boolean fireEvents)Removes value stored on the key specified.voidsetStatsEnabled(boolean enabled)
-
-
-
Method Detail
-
getWithLoader
java.lang.Object getWithLoader(CacheKey key, CacheValueLoader loader) throws CacheValueLoadException
Gets value from cache. Invokes loader if necessary. Must be thread safe.- Throws:
CacheValueLoadException
-
get
java.lang.Object get(CacheKey key)
Gets value from the cache. If value is absent returns null. Must be thread safe.
-
invalidate
java.lang.Object invalidate(CacheKey key, boolean fireEventsEvenIfNotRemoved)
Invalidates (removes) value from cache map. Must be thread safe.- Parameters:
fireEventsEvenIfNotRemoved-- Returns:
- an object invalidated from cache.
-
getName
java.lang.String getName()
Gets region name. Needed to resolve proper cache region.
-
getHandledTypes
java.lang.String[] getHandledTypes()
Gets types which can be stored in the region. Needed to resolve proper cache region.
Special type names are defined inRegionType.
-
getCacheRegionStatistics
CacheStatistics getCacheRegionStatistics()
Gets statistics for current region.
-
getCacheMaxEntries
long getCacheMaxEntries()
Gets number of cache entries above which invalidation occurs.
-
clearCache
void clearCache()
Removes all elements from cache.
-
registerLifecycleCallback
void registerLifecycleCallback(CacheLifecycleCallback callback)
This callback shall be called when eviction occurs.
-
getMaxReachedSize
long getMaxReachedSize()
Returns number of elements currently in the cache
-
getAllKeys
java.util.Collection<CacheKey> getAllKeys()
Returns all keys currently stored in this region.
-
remove
java.lang.Object remove(CacheKey key, boolean fireEvents)
Removes value stored on the key specified. This method does not update statistics. Returns value removed or null.
-
containsKey
boolean containsKey(CacheKey key)
Checks if key is in the cache map.
-
setStatsEnabled
void setStatsEnabled(boolean enabled)
-
isStatsEnabled
boolean isStatsEnabled()
-
-