public static final int DEFAULT_SCOPE = 0;
public static final int GLOBAL_SCOPE = 1;
public static final int LOCAL_SCOPE = 2;
public static Set<byte[]> getAllKeys(Cache<byte[], ?> cache, int scope) {
CacheMode cacheMode = cache.getAdvancedCache().getCacheConfiguration().clustering().cacheMode();
boolean keysAreLocal = !cacheMode.isClustered() || cacheMode.isReplicated();
if (keysAreLocal || scope == LOCAL_SCOPE) {
return cache.keySet();
} else {
MapReduceTask<byte[], Object, byte[], Object> task =
new MapReduceTask<byte[], Object, byte[], Object>((Cache<byte[], Object>) cache)