GuavaCache(com.google.common.cache.Cache<K, V> cache, Ticker ticker, boolean isRecordingStats) { this.statsCounter = new SimpleStatsCounter(); this.isRecordingStats = isRecordingStats; this.cache = requireNonNull(cache); this.ticker = ticker; }
@Override public StatsCounter get() { return new SimpleStatsCounter(); } };
@Override public CacheStats stats() { SimpleStatsCounter aggregator = new SimpleStatsCounter(); aggregator.incrementBy(localCache.globalStatsCounter); for (Segment<K, V> segment : localCache.segments) { aggregator.incrementBy(segment.statsCounter); } return aggregator.snapshot(); }
@Override public StatsCounter get() { return new SimpleStatsCounter(); } };
@Override public StatsCounter get() { return new SimpleStatsCounter(); } };
@Override public CacheStats stats() { SimpleStatsCounter aggregator = new SimpleStatsCounter(); aggregator.incrementBy(localCache.globalStatsCounter); for (Segment<K, V> segment : localCache.segments) { aggregator.incrementBy(segment.statsCounter); } return aggregator.snapshot(); }
@Override public CacheStats stats() { SimpleStatsCounter aggregator = new SimpleStatsCounter(); aggregator.incrementBy(localCache.globalStatsCounter); for (Segment<K, V> segment : localCache.segments) { aggregator.incrementBy(segment.statsCounter); } return aggregator.snapshot(); }
@Override public CacheStats stats() { SimpleStatsCounter aggregator = new SimpleStatsCounter(); aggregator.incrementBy(localCache.globalStatsCounter); for (Segment<K, V> segment : localCache.segments) { aggregator.incrementBy(segment.statsCounter); } return aggregator.snapshot(); }
@Override public CacheStats stats() { SimpleStatsCounter aggregator = new SimpleStatsCounter(); aggregator.incrementBy(localCache.globalStatsCounter); for (Segment<K, V> segment : localCache.segments) { aggregator.incrementBy(segment.statsCounter); } return aggregator.snapshot(); }
statsCounter = new SimpleStatsCounter();
@Override public StatsCounter get() { return new SimpleStatsCounter(); } };
@Override public CacheStats stats() { SimpleStatsCounter aggregator = new SimpleStatsCounter(); aggregator.incrementBy(localCache.globalStatsCounter); for (Segment<K, V> segment : localCache.segments) { aggregator.incrementBy(segment.statsCounter); } return aggregator.snapshot(); }
public void testSimpleStatsIncrementBy() { long totalLoadTime = 0; SimpleStatsCounter counter1 = new SimpleStatsCounter(); for (int i = 0; i < 11; i++) { counter1.recordHits(1); SimpleStatsCounter counter2 = new SimpleStatsCounter(); for (int i = 0; i < 27; i++) { counter2.recordHits(1);
private void readObject(ObjectInputStream stream) throws InvalidObjectException { statsCounter = new SimpleStatsCounter(); } };
public void testSingleSimpleStats() { StatsCounter counter = new SimpleStatsCounter(); for (int i = 0; i < 11; i++) { counter.recordHits(1);
@Override public CacheStats stats() { SimpleStatsCounter aggregator = new SimpleStatsCounter(); aggregator.incrementBy(localCache.globalStatsCounter); for (Segment<K, V> segment : localCache.segments) { aggregator.incrementBy(segment.statsCounter); } return aggregator.snapshot(); }
@Override public StatsCounter get() { return new SimpleStatsCounter(); } };
public void testEmptySimpleStats() { StatsCounter counter = new SimpleStatsCounter(); CacheStats stats = counter.snapshot(); assertEquals(0, stats.requestCount()); assertEquals(0, stats.hitCount()); assertEquals(1.0, stats.hitRate()); assertEquals(0, stats.missCount()); assertEquals(0.0, stats.missRate()); assertEquals(0, stats.loadSuccessCount()); assertEquals(0, stats.loadExceptionCount()); assertEquals(0, stats.loadCount()); assertEquals(0, stats.totalLoadTime()); assertEquals(0.0, stats.averageLoadPenalty()); assertEquals(0, stats.evictionCount()); }
@Override public StatsCounter get() { return new SimpleStatsCounter(); } };
@Override public CacheStats stats() { SimpleStatsCounter aggregator = new SimpleStatsCounter(); aggregator.incrementBy(localCache.globalStatsCounter); for (Segment<K, V> segment : localCache.segments) { aggregator.incrementBy(segment.statsCounter); } return aggregator.snapshot(); }