@Override public boolean containsKey(K key) { ensureOpen(); validateNotNull(key); final Data keyData = toData(key); Object cached = nearCache != null ? nearCache.get(keyData) : null; if (cached != null && !NearCache.NULL_OBJECT.equals(cached)) { return true; } ClientMessage request = CacheContainsKeyCodec.encodeRequest(nameWithPrefix, keyData); ClientMessage result = invoke(request, keyData); return CacheContainsKeyCodec.decodeResponse(result).response; }
private Map<K, V> getAllFromNearCache(Set<Data> keySet) { Map<K, V> result = new HashMap<K, V>(); if (nearCache != null) { final Iterator<Data> iterator = keySet.iterator(); while (iterator.hasNext()) { Data key = iterator.next(); Object cached = nearCache.get(key); if (cached != null && !NearCache.NULL_OBJECT.equals(cached)) { result.put((K) toObject(key), (V) cached); iterator.remove(); } } } return result; }