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:
  • 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 Details

    • getWithLoader

      Object getWithLoader(CacheKey key, CacheValueLoader loader) throws CacheValueLoadException
      Gets value from cache. Invokes loader if necessary. Must be thread safe.
      Throws:
      CacheValueLoadException
    • get

      Object get(CacheKey key)
      Gets value from the cache. If value is absent returns null. Must be thread safe.
    • invalidate

      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

      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 in RegionType.
    • 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

      Collection<CacheKey> getAllKeys()
      Returns all keys currently stored in this region.
    • remove

      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()