Interface CacheRegion
- All Known Subinterfaces:
UnlimitedCacheRegion
- All Known Implementing Classes:
AbstractMapBasedCacheRegion,DefaultCacheRegion,EHCacheRegion,FacetSearchConfigCacheRegion,LRUCacheRegion,MediaCacheRegion,RelationCacheRegion,ScriptsCacheRegion,UnlimitedCacheRegion,WebhookDeletedItemCacheRegion
public interface CacheRegion
Defines interface for the cache region.
Region is defined on the base of:
For region resolve strategy see
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 see
CacheRegionResolver.-
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves all elements from cache.booleancontainsKey(CacheKey key) Checks if key is in the cache map.Gets value from the cache.Returns all keys currently stored in this region.longGets number of cache entries above which invalidation occurs.Gets statistics for current region.String[]Gets types which can be stored in the region.longReturns number of elements currently in the cachegetName()Gets region name.getWithLoader(CacheKey key, CacheValueLoader loader) Gets value from cache.invalidate(CacheKey key, boolean fireEventsEvenIfNotRemoved) Invalidates (removes) value from cache map.booleanvoidThis callback shall be called when eviction occurs.Removes value stored on the key specified.voidsetStatsEnabled(boolean enabled)
-
Method Details
-
getWithLoader
Gets value from cache. Invokes loader if necessary. Must be thread safe.- Throws:
CacheValueLoadException
-
get
Gets value from the cache. If value is absent returns null. Must be thread safe. -
invalidate
Invalidates (removes) value from cache map. Must be thread safe.- Parameters:
fireEventsEvenIfNotRemoved-- Returns:
- an object invalidated from cache.
-
getName
String getName()Gets region name. Needed to resolve proper cache region. -
getHandledTypes
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
This callback shall be called when eviction occurs. -
getMaxReachedSize
long getMaxReachedSize()Returns number of elements currently in the cache -
getAllKeys
Collection<CacheKey> getAllKeys()Returns all keys currently stored in this region. -
remove
Removes value stored on the key specified. This method does not update statistics. Returns value removed or null. -
containsKey
Checks if key is in the cache map. -
setStatsEnabled
void setStatsEnabled(boolean enabled) -
isStatsEnabled
boolean isStatsEnabled()
-