public void testUpdateRecency_onGet() { IdentityLoader<Integer> loader = identityLoader(); final LoadingCache<Integer, Integer> cache = CacheBuilder.newBuilder().maximumSize(MAX_SIZE).build(loader); CacheTesting.checkRecency(cache, MAX_SIZE, new Receiver<ReferenceEntry<Integer, Integer>>() { @Override public void accept(ReferenceEntry<Integer, Integer> entry) { cache.getUnchecked(entry.getKey()); } }); }
public void testUpdateRecency_onInvalidate() { IdentityLoader<Integer> loader = identityLoader(); final LoadingCache<Integer, Integer> cache = CacheBuilder.newBuilder() .maximumSize(MAX_SIZE) .concurrencyLevel(1) .build(loader); CacheTesting.checkRecency(cache, MAX_SIZE, new Receiver<ReferenceEntry<Integer, Integer>>() { @Override public void accept(ReferenceEntry<Integer, Integer> entry) { Integer key = entry.getKey(); cache.invalidate(key); } }); }
public void testUpdateRecency_onGet() { IdentityLoader<Integer> loader = identityLoader(); final LoadingCache<Integer, Integer> cache = CacheBuilder.newBuilder().maximumSize(MAX_SIZE).build(loader); CacheTesting.checkRecency( cache, MAX_SIZE, new Receiver<ReferenceEntry<Integer, Integer>>() { @Override public void accept(ReferenceEntry<Integer, Integer> entry) { cache.getUnchecked(entry.getKey()); } }); }
public void testUpdateRecency_onInvalidate() { IdentityLoader<Integer> loader = identityLoader(); final LoadingCache<Integer, Integer> cache = CacheBuilder.newBuilder().maximumSize(MAX_SIZE).concurrencyLevel(1).build(loader); CacheTesting.checkRecency( cache, MAX_SIZE, new Receiver<ReferenceEntry<Integer, Integer>>() { @Override public void accept(ReferenceEntry<Integer, Integer> entry) { Integer key = entry.getKey(); cache.invalidate(key); } }); }