@Test public void testInvalidate() { stringDoubler.getUnchecked("10"); assertEquals(stringDoubler.size(), 1); stringDoubler.invalidate(new Object()); assertEquals(stringDoubler.size(), 1); stringDoubler.invalidate("10"); assertEquals(stringDoubler.size(), 0, "Expected cache to be empty after sole entry was invalidated"); }
@Override public void invalidate(Object key) { try { @SuppressWarnings("unchecked") A cast = (A) key; delegate().invalidate(keyTransformer().apply(cast)); } catch (ClassCastException e) { } }
KeyTransformingLoadingCache extends AbstractLoadingCache<A, V> { @Override public void invalidate(Object key) { try { @SuppressWarnings("unchecked") A cast = (A) key; delegate().invalidate(keyTransformer().apply(cast)); } catch (ClassCastException e) { } } }
KeyTransformingLoadingCache extends AbstractLoadingCache<A, V> { @Override public void invalidate(Object key) { try { @SuppressWarnings("unchecked") A cast = (A) key; delegate().invalidate(keyTransformer().apply(cast)); } catch (ClassCastException e) { } } KeyTransformingLoadingCache(LoadingCache<B, V> delegate, Function<A, B> keyTransformer); }
KeyTransformingLoadingCache extends AbstractLoadingCache<A, V> { @Override public void invalidate(Object key) { try { @SuppressWarnings("unchecked") A cast = (A) key; delegate().invalidate(keyTransformer().apply(cast)); } catch (ClassCastException e) { } } KeyTransformingLoadingCache(LoadingCache<B, V> delegate, Function<A, B> keyTransformer); static KeyTransformingLoadingCache<A, B, V> from(LoadingCache<B, V> delegate, Function<A, B> keyTransformer); @Override V getIfPresent(Object key); @Override V get(A key, Callable<? extends V> valueLoader); @Override ImmutableMap<A, V> getAllPresent(Iterable<?> keys); @Override void put(A key, V value); @Override void invalidate(Object key); @Override void invalidateAll(); @Override long size(); @Override CacheStats stats(); @Override V get(A key); @Override void refresh(A key); @Override ConcurrentMap<A, V> asMap(); @Override void cleanUp(); }
KeyTransformingLoadingCache extends AbstractLoadingCache<A, V> { @Override public void invalidate(Object key) { try { @SuppressWarnings("unchecked") A cast = (A) key; delegate().invalidate(keyTransformer().apply(cast)); } catch (ClassCastException e) { } } KeyTransformingLoadingCache(LoadingCache<B, V> delegate, Function<A, B> keyTransformer); static KeyTransformingLoadingCache<A, B, V> from(LoadingCache<B, V> delegate, Function<A, B> keyTransformer); @Override V getIfPresent(Object key); @Override V get(A key, Callable<? extends V> valueLoader); @Override ImmutableMap<A, V> getAllPresent(Iterable<?> keys); @Override void put(A key, V value); @Override void invalidate(Object key); @Override void invalidateAll(); @Override long size(); @Override CacheStats stats(); @Override V get(A key); @Override void refresh(A key); @Override ConcurrentMap<A, V> asMap(); @Override void cleanUp();  }