You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2022/05/16 19:59:59 UTC

[GitHub] [accumulo] EdColeman commented on a diff in pull request #2709: Replaced HashMap in ZooCacheFactory with bounded-size Cache

EdColeman commented on code in PR #2709:
URL: https://github.com/apache/accumulo/pull/2709#discussion_r874107324


##########
core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCacheFactory.java:
##########
@@ -18,18 +18,17 @@
  */
 package org.apache.accumulo.fate.zookeeper;
 
-import java.util.HashMap;
-import java.util.Map;
-
 import org.apache.accumulo.core.singletons.SingletonManager;
 import org.apache.accumulo.core.singletons.SingletonService;
 
+import com.github.benmanes.caffeine.cache.Cache;
+import com.github.benmanes.caffeine.cache.Caffeine;
+
 /**
  * A factory for {@link ZooCache} instances.
  */
 public class ZooCacheFactory {
-  // TODO: make this better - LRU, soft references, ...
-  private static Map<String,ZooCache> instances = new HashMap<>();
+  private static Cache<String,ZooCache> instances = Caffeine.newBuilder().maximumSize(5).build();

Review Comment:
   Why a max size of 5?  What determines that number?



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org