Class CacheUtils

java.lang.Object
org.springframework.geode.util.CacheUtils

public abstract class CacheUtils extends Object
Abstract utility class for working with Apache Geode cache instances, such as ClientCache and peer Cache instances.
Since:
1.3.0
See Also:
  • Cache
  • DataPolicy
  • Region
  • RegionAttributes
  • RegionService
  • ClientCache
  • Pool
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> Collection<T>
    collectValues(org.apache.geode.cache.Region<?,T> region)
    Collects all values from the given Region.
    static boolean
    isClientCache(org.apache.geode.cache.RegionService regionService)
    Null-safe method to determine whether the given RegionService is an instance of ClientCache.
    static boolean
    isClientRegion(org.apache.geode.cache.Region<?,?> region)
    Null-safe method to determine whether the given Region is a client Region in a ClientCache.
    static boolean
    isPeerCache(org.apache.geode.cache.RegionService regionService)
    Null-safe method to determine whether the given RegionService is an instance of a peer Cache.
    static boolean
    isPeerRegion(org.apache.geode.cache.Region<?,?> region)
    Null-safe method to determine whether the given Region is a peer Region in a peer Cache.
    static boolean
    isProxyRegion(org.apache.geode.cache.Region<?,?> region)
    Null-safe method to determine whether the given Region is a [client] PROXY Region.
    static boolean
    isRegionWithPool(org.apache.geode.cache.Region<?,?> region)
    Null-safe method to determine whether the given Region was configured with a Pool.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CacheUtils

      public CacheUtils()
  • Method Details

    • collectValues

      public static <T> Collection<T> collectValues(org.apache.geode.cache.Region<?,T> region)
      Collects all values from the given Region. This method is capable of pulling values from either client or peer Regions.
      Type Parameters:
      T - type of the Region values.
      Parameters:
      region - Region from which to collect the values.
      Returns:
      a Collection of all values from the given Region.
      Throws:
      IllegalArgumentException - if Region is null.
      See Also:
    • isClientCache

      public static boolean isClientCache(org.apache.geode.cache.RegionService regionService)
      Null-safe method to determine whether the given RegionService is an instance of ClientCache. The problem is, GemFireCacheImpl implements both the (peer) Cache and ClientCache interfaces. #sigh
      Parameters:
      regionService - RegionService to evaluate.
      Returns:
      a boolean value indicating whether the RegionService an instance of ClientCache.
      See Also:
      • ClientCache
      • RegionService
    • isClientRegion

      public static boolean isClientRegion(org.apache.geode.cache.Region<?,?> region)
      Null-safe method to determine whether the given Region is a client Region in a ClientCache.
      Parameters:
      region - Region to evaluate.
      Returns:
      a boolean value indicating whether the given Region is a client Region.
      See Also:
    • isPeerCache

      public static boolean isPeerCache(org.apache.geode.cache.RegionService regionService)
      Null-safe method to determine whether the given RegionService is an instance of a peer Cache. The problem is, GemFireCacheImpl implements both the (peer) Cache and ClientCache interfaces. #sigh
      Parameters:
      regionService - RegionService to evaluate.
      Returns:
      a boolean value indicating whether the RegionService is an instance of a peer Cache.
      See Also:
      • RegionService
      • Cache
    • isPeerRegion

      public static boolean isPeerRegion(org.apache.geode.cache.Region<?,?> region)
      Null-safe method to determine whether the given Region is a peer Region in a peer Cache.
      Parameters:
      region - Region to evaluate.
      Returns:
      a boolean value indicating whether the given Region is a peer Region.
      See Also:
    • isProxyRegion

      public static boolean isProxyRegion(org.apache.geode.cache.Region<?,?> region)
      Null-safe method to determine whether the given Region is a [client] PROXY Region. The Region is a PROXY if the DataPolicy is DataPolicy.EMPTY or the Region has a configured Pool.
      Parameters:
      region - Region to evaluate.
      Returns:
      a boolean value to determine whether the Region is a [client] PROXY Region.
      See Also:
    • isRegionWithPool

      public static boolean isRegionWithPool(org.apache.geode.cache.Region<?,?> region)
      Null-safe method to determine whether the given Region was configured with a Pool. A Region configured with a Pool (by name specified in the RegionAttributes) is a strong indicator that the Region is a client Region.
      Parameters:
      region - Region to evaluate.
      Returns:
      a boolean to determine whether the given Region was configured with a Pool.
      See Also:
      • Pool
      • Region