EungsopYoo commented on code in PR #7291:
URL: https://github.com/apache/hbase/pull/7291#discussion_r2427997831


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RowCache.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.regionserver;
+
+import com.github.benmanes.caffeine.cache.Cache;
+import com.github.benmanes.caffeine.cache.Caffeine;
+import com.github.benmanes.caffeine.cache.Policy;
+import com.github.benmanes.caffeine.cache.RemovalCause;
+import com.github.benmanes.caffeine.cache.RemovalListener;
+import java.util.Optional;
+import java.util.OptionalLong;
+import java.util.concurrent.atomic.LongAdder;
+import org.checkerframework.checker.nullness.qual.NonNull;
+
+/**
+ * A cache that stores rows retrieved by Get operations, using Caffeine as the 
underlying cache
+ * implementation.
+ */
[email protected]
+public class RowCache {
+  private final class EvictionListener
+    implements RemovalListener<@NonNull RowCacheKey, @NonNull RowCells> {
+    @Override
+    public void onRemoval(RowCacheKey key, RowCells value, @NonNull 
RemovalCause cause) {
+      evictedRowCount.increment();
+    }
+  }
+
+  private final Cache<@NonNull RowCacheKey, RowCells> cache;
+
+  private final LongAdder hitCount = new LongAdder();
+  private final LongAdder missCount = new LongAdder();
+  private final LongAdder evictedRowCount = new LongAdder();
+

Review Comment:
   
https://github.com/apache/hbase/pull/7291/commits/ffba4176f6f2947994ccd2ac94868caaf59cbbf2
   I tried, but evictedRowCount cannot be obtained from Cache.stats().



-- 
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