// which we do care about.
if (notification.getCause() == RemovalCause.SIZE) {
evictions++;
if (evictions >= nextLogThreshold) {
Logger logger = Logger.getLogger(ConfigAdapterImpl.class);
CacheStats stats = cache.stats();
logger.info(String.format(
"Cache %s evicted %d entries for size pressure, hit rate=%.3f, evictions=%d, loads=%d %s",
name, evictions, stats.hitRate(), stats.evictionCount(),
stats.loadCount(), stats.toString()));
// We want to log every 10 until 100, every 100 until 1000, every 1000 thereafter
if (nextLogThreshold == 1) {
nextLogThreshold = 10;
} else if (nextLogThreshold < 100) {
nextLogThreshold += 10;
} else if (nextLogThreshold < 1000) {
nextLogThreshold += 100;
} else {
nextLogThreshold += 1000;
}
}
}
if (System.currentTimeMillis() >= lastFull + ONE_DAY) {
Logger logger = Logger.getLogger(ConfigAdapterImpl.class);
CacheStats stats = cache.stats();
logger.info(String.format("Cache %s has hit rate=%.3f, stats %s\n",
name, stats.hitRate(), stats.toString()));
}
}