You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What the cache does is LRU, but on a per-segment basis: the cache is divided into concurrencyLevel segments, each of which does LRU internally with a size cap of maximumSize/concurrencyLevel.
Hi,
Javadoc of CacheBuilder says it uses LRU as eviction policy, but my test says otherwise..
`private static void testCacheEvictionPolicy() {
int maxSz = 3;
LoadingCache<Integer, Integer> cache = CacheBuilder.newBuilder().maximumSize(maxSz).build(new CacheLoader<Integer, Integer>() {
@OverRide
public Integer load(Integer integer) throws Exception {
return integer;
}
});
callCache(cache, 3);
printCache(cache);
for (int i = 0; i < 1000; i++) {
callCache(cache, 1);
}
callCache(cache, 4);
printCache(cache);
}
output:
The text was updated successfully, but these errors were encountered: