rishabhdaim commented on code in PR #2864:
URL: https://github.com/apache/jackrabbit-oak/pull/2864#discussion_r3092814442


##########
oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/WriterCacheManager.java:
##########
@@ -351,17 +351,20 @@ public CacheStatsMBean getTemplateCacheStats() {
         }
 
         @NotNull
-        private static <T> Supplier<CacheStats> accumulateRecordCacheStats(
+        private static <T> Supplier<CacheStatsSnapshot> 
accumulateRecordCacheStats(
                 final Iterable<RecordCache<T>> caches) {
-            return new Supplier<CacheStats>() {
-                @Override
-                public CacheStats get() {
-                    CacheStats stats = new CacheStats(0, 0, 0, 0, 0, 0);
-                    for (RecordCache<?> cache : caches) {
-                        stats = stats.plus(cache.getStats());
-                    }
-                    return stats;
+            return () -> {
+                long hits = 0, misses = 0, loads = 0, failures = 0, loadTime = 
0, evictions = 0;
+                for (RecordCache<?> cache : caches) {
+                    CacheStatsSnapshot s = cache.getStats();
+                    hits += s.hitCount();
+                    misses += s.missCount();
+                    loads += s.loadSuccessCount();
+                    failures += s.loadFailureCount();
+                    loadTime += s.totalLoadTime();
+                    evictions += s.evictionCount();

Review Comment:
   added in 
https://github.com/apache/jackrabbit-oak/pull/2864/commits/809e98790f5821f7245237d050505a510a366796



##########
oak-core-spi/src/test/java/org/apache/jackrabbit/oak/cache/api/CacheStatsTest.java:
##########
@@ -20,7 +20,7 @@
 import org.junit.Test;
 
 /** Tests for {@link CacheStatsSnapshot}. */
-public class CacheStatsSnapshotTest {
+public class CacheStatsTest {

Review Comment:
   added in 
https://github.com/apache/jackrabbit-oak/pull/2864/commits/809e98790f5821f7245237d050505a510a366796



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to