29.6. Distributed Execution and Locality
ConsistentHash, is theoretical; neither of these classes have any knowledge if data is actively in the cache. Instead, these classes are used to determine which node should store the specified key.
- Option 1: Confirm that the key is both found in the cache and the
DistributionManagerindicates it is local, as seen in the following example:
(cache.getAdvancedCache().withFlags(SKIP_REMOTE_LOOKUP).containsKey(key) && cache.getAdvancedCache().getDistributionManager().getLocality(key).isLocal())
- Option 2: Query the
NoteIf the entry is passivated then the
False, regardless of the key's presence.