/** @since 11.0 */ @Override public V get(K key, Callable<? extends V> valueLoader) throws ExecutionException { return delegate().get(key, valueLoader); }
@Override public synchronized void close() { if (cache != null) { cache.invalidateAll(); } }
CacheEntry refreshEntry(CacheEntry newEntry) { cache.put(newEntry.key, newEntry); return newEntry; }
CacheEntry cacheEntry; try { cacheEntry = cache.get(key, () -> newEntry); } catch (ExecutionException e) { throw new IllegalStateException(e); CacheEntry currentEntry = cache.getIfPresent(key); if (currentEntry == cacheEntry || currentEntry == null) {
/** @since 11.0 */ @Override @NullableDecl public V getIfPresent(Object key) { return delegate().getIfPresent(key); }
@Override public long size() { return delegate().size(); }
/** @since 12.0 */ @Override public void putAll(Map<? extends K, ? extends V> m) { delegate().putAll(m); }
/** @since 11.0 */ @Override public ImmutableMap<K, V> getAllPresent(Iterable<?> keys) { return delegate().getAllPresent(keys); }
@Override public ConcurrentMap<K, V> asMap() { return delegate().asMap(); }
@Override public void invalidate(Object key) { delegate().invalidate(key); }
@Override public void cleanUp() { delegate().cleanUp(); }
@VisibleForTesting CacheEntry get(ClientId clientId, long callId) { return cache.getIfPresent(new CacheKey(clientId, callId)); }
@VisibleForTesting long size() { return cache.size(); }
/** @since 11.0 */ @Override public void invalidateAll(Iterable<?> keys) { delegate().invalidateAll(keys); }
CacheEntry getOrCreateEntry(ClientId clientId, long callId) { final CacheKey key = new CacheKey(clientId, callId); final CacheEntry entry; try { entry = cache.get(key, () -> new CacheEntry(key)); } catch (ExecutionException e) { throw new IllegalStateException(e); } Preconditions.assertTrue(entry != null && !entry.isCompletedNormally(), "retry cache entry should be pending: %s", entry); return entry; }
/** @since 11.0 */ @Override public void put(K key, V value) { delegate().put(key, value); }
@Override public void invalidateAll() { delegate().invalidateAll(); }