gedi.solutions.geode.operations.RegionOps Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gedi-geode-extensions-core Show documentation
Show all versions of gedi-geode-extensions-core Show documentation
GemFire Enterprise Data Integration - common development extensions powered by Apache Geode
The newest version!
package gedi.solutions.geode.operations;
import java.util.Set;
import org.apache.geode.cache.Region;
public class RegionOps
{
/**
*
* @param region the region
*/
public static void clearAll(Region,?> region)
{
Set> set = region.keySetOnServer();
//TODO: would be nice to have a bulk remove method
set.stream().forEach(k -> region.remove(k));
}//------------------------------------------------
public static boolean isEmpty(Region,?> region)
{
return size(region) == 0;
}//------------------------------------------------
public static int size(Region,?> region)
{
Set> set = region.keySetOnServer();
if(set == null || set.isEmpty())
return 0;
return set.size();
}//------------------------------------------------
}