Java Code Examples for com.github.benmanes.caffeine.cache.stats.CacheStats#plus()
The following examples show how to use
com.github.benmanes.caffeine.cache.stats.CacheStats#plus() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CacheStatsTest.java From caffeine with Apache License 2.0 | 6 votes |
public void testPlus() { CacheStats one = new CacheStats(11, 13, 15, 13, 11, 9, 18); CacheStats two = new CacheStats(53, 47, 41, 39, 37, 35, 70); CacheStats sum = two.plus(one); assertEquals(124, sum.requestCount()); assertEquals(64, sum.hitCount()); assertEquals(64.0/124, sum.hitRate()); assertEquals(60, sum.missCount()); assertEquals(60.0/124, sum.missRate()); assertEquals(56, sum.loadSuccessCount()); assertEquals(52, sum.loadFailureCount()); assertEquals(52.0/108, sum.loadFailureRate()); assertEquals(56 + 52, sum.loadCount()); assertEquals(48, sum.totalLoadTime()); assertEquals(48.0/(56 + 52), sum.averageLoadPenalty()); assertEquals(44, sum.evictionCount()); assertEquals(88, sum.evictionWeight()); assertEquals(sum, one.plus(two)); }
Example 2
Source File: CacheStatsTest.java From caffeine with Apache License 2.0 | 5 votes |
public void testPlusLarge() { CacheStats maxCacheStats = new CacheStats( Long.MAX_VALUE, Long.MAX_VALUE, Long.MAX_VALUE, Long.MAX_VALUE, Long.MAX_VALUE, Long.MAX_VALUE, Long.MAX_VALUE); CacheStats smallCacheStats = new CacheStats(1, 1, 1, 1, 1, 1, 1); CacheStats sum = smallCacheStats.plus(maxCacheStats); assertEquals(Long.MAX_VALUE, sum.requestCount()); assertEquals(Long.MAX_VALUE, sum.hitCount()); assertEquals(1.0, sum.hitRate()); assertEquals(Long.MAX_VALUE, sum.missCount()); assertEquals(1.0, sum.missRate()); assertEquals(Long.MAX_VALUE, sum.loadSuccessCount()); assertEquals(Long.MAX_VALUE, sum.loadFailureCount()); assertEquals(1.0, sum.loadFailureRate()); assertEquals(Long.MAX_VALUE, sum.loadCount()); assertEquals(Long.MAX_VALUE, sum.totalLoadTime()); assertEquals(1.0, sum.averageLoadPenalty()); assertEquals(Long.MAX_VALUE, sum.evictionCount()); assertEquals(Long.MAX_VALUE, sum.evictionWeight()); assertEquals(sum, maxCacheStats.plus(smallCacheStats)); }