@Test public void testExpiryByFull() { Map<String, String> backing = new HashMap<>(); for (int i = 1; i <= 100; i++) { backing.put("foo" + i, Integer.toString(i)); } Lookup<String> delegate = new MapLookup<>(backing); CacheConfig config = new CacheConfig(0, 10); CachingLookup<String> lookup = new CachingLookup<>(delegate, config); Assert.assertEquals("1", lookup.lookup("foo1")); for (int i = 1; i <= 100; i++) { Assert.assertEquals(Integer.toString(i), lookup.lookup("foo" + i)); } backing.put("foo1", "sdf"); Assert.assertEquals("sdf", lookup.lookup("foo1")); }
@Override public T lookup(String key) { return cache.getUnchecked(key); }
CachingLookup implements Lookup<T> { @Override public T lookup(String key) { return cache.getUnchecked(key); } }
CachingLookup implements Lookup<T> { @Override public T lookup(String key) { return cache.getUnchecked(key); } CachingLookup(final Lookup<T> delegate, CacheConfig cacheConfig); }
CachingLookup implements Lookup<T> { @Override public T lookup(String key) { return cache.getUnchecked(key); } CachingLookup(final Lookup<T> delegate, CacheConfig cacheConfig); @Override T lookup(String key); @Override Map<String, T> lookup(String... keys); @Override Map<String, T> lookup(Set<String> keys); }
CachingLookup implements Lookup<T> { @Override public T lookup(String key) { return cache.getUnchecked(key); } CachingLookup(final Lookup<T> delegate, CacheConfig cacheConfig); @Override T lookup(String key); @Override Map<String, T> lookup(String... keys); @Override Map<String, T> lookup(Set<String> keys);  }