@Override public Map<K, V> getAllPresent(Iterable<K> keys) { return cache.getAllPresent(keys); }
@Override public ImmutableMap<K, V> getAllPresent(Iterable<?> keys) { return delegate.getAllPresent(keys); }
/** @since 11.0 */ @Override public ImmutableMap<K, V> getAllPresent(Iterable<?> keys) { return delegate().getAllPresent(keys); }
/** @since 11.0 */ @Override public ImmutableMap<K, V> getAllPresent(Iterable<?> keys) { return delegate().getAllPresent(keys); }
/** @since 11.0 */ @Override public ImmutableMap<K, V> getAllPresent(Iterable<?> keys) { return delegate().getAllPresent(keys); }
public void testGetAllPresent() throws ExecutionException { when(mock.getAllPresent(ImmutableList.of("key"))) .thenReturn(ImmutableMap.of("key", Boolean.TRUE)); assertEquals( ImmutableMap.of("key", Boolean.TRUE), forward.getAllPresent(ImmutableList.of("key"))); }
public void testGetAllPresent_empty() { Cache<Object, Object> cache = new AbstractCache<Object, Object>() { @Override public Object getIfPresent(Object key) { return null; } }; assertEquals(ImmutableMap.of(), cache.getAllPresent(ImmutableList.of(new Object()))); }
@Override public Map<K, V> getAllPresent(Iterable<?> keys) { requireNonNull(keys); keys.forEach(Objects::requireNonNull); return cache.getAllPresent(keys); }
public void testGetAllPresent_cached() { final Object cachedKey = new Object(); final Object cachedValue = new Object(); Cache<Object, Object> cache = new AbstractCache<Object, Object>() { @Override public Object getIfPresent(Object key) { return cachedKey.equals(key) ? cachedValue : null; } }; assertEquals( ImmutableMap.of(cachedKey, cachedValue), cache.getAllPresent(ImmutableList.of(cachedKey, new Object()))); }
assertEquals(0, stats.hitCount()); assertEquals(ImmutableMap.of(), cache.getAllPresent(ImmutableList.<Integer>of())); stats = cache.stats(); assertEquals(0, stats.missCount()); assertEquals(0, stats.hitCount()); assertEquals(ImmutableMap.of(), cache.getAllPresent(asList(1, 2, 3))); stats = cache.stats(); assertEquals(3, stats.missCount()); assertEquals(ImmutableMap.of(2, 22), cache.getAllPresent(asList(1, 2, 3))); stats = cache.stats(); assertEquals(5, stats.missCount()); assertEquals(ImmutableMap.of(2, 22, 3, 33), cache.getAllPresent(asList(1, 2, 3))); stats = cache.stats(); assertEquals(6, stats.missCount()); assertEquals(ImmutableMap.of(1, 11, 2, 22, 3, 33), cache.getAllPresent(asList(1, 2, 3))); stats = cache.stats(); assertEquals(6, stats.missCount());
assertEquals(0, stats.hitCount()); assertEquals(ImmutableMap.of(), cache.getAllPresent(ImmutableList.<Integer>of())); stats = cache.stats(); assertEquals(0, stats.missCount()); assertEquals(0, stats.hitCount()); assertEquals(ImmutableMap.of(), cache.getAllPresent(asList(1, 2, 3))); stats = cache.stats(); assertEquals(3, stats.missCount()); assertEquals(ImmutableMap.of(2, 22), cache.getAllPresent(asList(1, 2, 3))); stats = cache.stats(); assertEquals(5, stats.missCount()); assertEquals(ImmutableMap.of(2, 22, 3, 33), cache.getAllPresent(asList(1, 2, 3))); stats = cache.stats(); assertEquals(6, stats.missCount()); assertEquals(ImmutableMap.of(1, 11, 2, 22, 3, 33), cache.getAllPresent(asList(1, 2, 3))); stats = cache.stats(); assertEquals(6, stats.missCount());
@Override public CompletableFuture<Map<K, V>> getAllAsync(List<K> keys) { CompletableFuture<Map<K, V>> future = new CompletableFuture<>(); try { future.complete(cache.getAllPresent(keys)); } catch (Exception e) { future.completeExceptionally(e); } return future; }
@Override public CompletableFuture<Map<K, V>> getAllAsync(List<K> keys) { CompletableFuture<Map<K, V>> future = new CompletableFuture<>(); try { future.complete(cache.getAllPresent(keys)); } catch (Exception e) { future.completeExceptionally(e); } return future; }
/** * @since 11.0 */ @Override public ImmutableMap<K, V> getAllPresent(Iterable<?> keys) { return delegate().getAllPresent(keys); }
/** * @since 11.0 */ @Override public ImmutableMap<K, V> getAllPresent(Iterable<? extends K> keys) { return delegate().getAllPresent(keys); }
/** * @since 11.0 */ @Override public ImmutableMap<K, V> getAllPresent(Iterable<?> keys) { return delegate().getAllPresent(keys); }
/** * @since 11.0 */ @Override public ImmutableMap<K, V> getAllPresent(Iterable<?> keys) { return delegate().getAllPresent(keys); }
/** * @since 11.0 */ @Override public ImmutableMap<K, V> getAllPresent(Iterable<?> keys) { return delegate().getAllPresent(keys); }
@Override public ImmutableMap<K, V> getAllPresent( Iterable<?> keys) { Iterable<K> typedKeys = (Iterable<K>) keys; memCacheMetadata.incrementAll(keys); ImmutableMap<K, V> result = memCache.getAllPresent(keys); memCacheMetadata.removeAll(filter(typedKeys, not(in(result.keySet())))); return result; }
public void testGetAllPresent_empty() { Cache<Object, Object> cache = new AbstractCache<Object, Object>() { @Override public Object getIfPresent(Object key) { return null; } }; assertEquals( ImmutableMap.of(), cache.getAllPresent(ImmutableList.of(new Object()))); }