Class LocalRegionCache

java.lang.Object
com.hazelcast.hibernate.local.LocalRegionCache
All Implemented Interfaces:
RegionCache, org.hibernate.cache.spi.ExtendedStatisticsSupport, org.hibernate.cache.spi.Region
Direct Known Subclasses:
TimestampsRegionCache

public class LocalRegionCache extends Object implements RegionCache
Local only RegionCache implementation based on a topic to distribute cache updates.
  • Field Details

  • Constructor Details

    • LocalRegionCache

      protected LocalRegionCache(org.hibernate.cache.spi.RegionFactory regionFactory, String name, com.hazelcast.core.HazelcastInstance hazelcastInstance, org.hibernate.cache.cfg.spi.DomainDataRegionConfig regionConfig, boolean withTopic, LocalRegionCache.EvictionConfig evictionConfig, FreeHeapBasedCacheEvictor freeHeapBasedCacheEvictor)
      Parameters:
      regionFactory - the region factory
      name - the name for this region cache, which is also used to retrieve configuration/topic
      hazelcastInstance - the HazelcastInstance to which this region cache belongs, used to retrieve configuration and to lookup an ITopic to register a MessageListener with if withTopic is true (optional)
      regionConfig - the region configuration
      withTopic - true to register a MessageListener with the ITopic whose name matches this region cache if a HazelcastInstance was provided to look up the topic; otherwise, false not to register a listener even if an instance was provided
      evictionConfig - provides the parameters which should be used when evicting entries from the cache; if null, this will be derived from the Hazelcast MapConfig; if the MapConfig cannot be resolved, this will use defaults.
      freeHeapBasedCacheEvictor - performs the free-heap-based eviction
  • Method Details

    • builder

      public static LocalRegionCache.Builder builder()
    • afterUpdate

      public void afterUpdate(Object key, Object newValue, Object newVersion)
      Specified by:
      afterUpdate in interface RegionCache
    • contains

      public boolean contains(Object key)
      Specified by:
      contains in interface RegionCache
    • evictData

      public void evictData()
      Specified by:
      evictData in interface RegionCache
    • evictData

      public void evictData(Object key)
      Specified by:
      evictData in interface RegionCache
    • get

      public Object get(Object key, long txTimestamp)
      Specified by:
      get in interface RegionCache
    • getElementCountInMemory

      public long getElementCountInMemory()
      Specified by:
      getElementCountInMemory in interface org.hibernate.cache.spi.ExtendedStatisticsSupport
    • getName

      public String getName()
      Specified by:
      getName in interface org.hibernate.cache.spi.Region
    • getRegionFactory

      public org.hibernate.cache.spi.RegionFactory getRegionFactory()
      Specified by:
      getRegionFactory in interface org.hibernate.cache.spi.Region
    • getSizeInMemory

      public long getSizeInMemory()
      Specified by:
      getSizeInMemory in interface org.hibernate.cache.spi.ExtendedStatisticsSupport
    • put

      public boolean put(Object key, Object value, long txTimestamp, Object version)
      Specified by:
      put in interface RegionCache
    • unlockItem

      public void unlockItem(Object key, org.hibernate.cache.spi.access.SoftLock lock)
      Specified by:
      unlockItem in interface RegionCache
    • nextTimestamp

      public long nextTimestamp()
      Specified by:
      nextTimestamp in interface RegionCache
    • createMessage

      protected Object createMessage(Object key, Object value, Object currentVersion)
    • maybeInvalidate

      protected void maybeInvalidate(Object messageObject)
    • destroy

      public void destroy()
      Specified by:
      destroy in interface org.hibernate.cache.spi.Region
      Specified by:
      destroy in interface RegionCache