yuqi1129 commented on code in PR #6569:
URL: https://github.com/apache/gravitino/pull/6569#discussion_r1986665364


##########
core/src/main/java/org/apache/gravitino/metalake/MetalakeManager.java:
##########
@@ -64,6 +71,26 @@ public class MetalakeManager implements MetalakeDispatcher {
 
   private final IdGenerator idGenerator;
 
+  @VisibleForTesting
+  static final Cache<NameIdentifier, BaseMetalake> METALAKE_CACHE =
+      Caffeine.newBuilder()
+          .expireAfterAccess(24, TimeUnit.HOURS)
+          .removalListener((k, v, c) -> LOG.info("Closing metalake {}.", k))
+          .scheduler(
+              Scheduler.forScheduledExecutorService(
+                  new ScheduledThreadPoolExecutor(
+                      1,
+                      new ThreadFactoryBuilder()
+                          .setDaemon(true)
+                          .setNameFormat("metalake-cleaner-%d")
+                          .build())))
+          .build();
+
+  @VisibleForTesting
+  public static void clearCache() {

Review Comment:
   It's only for test usage; see `VisibleForTesting`. Typically, there is only 
one MetalakeManager instance in one Gravitino server, and there is no need to 
clear the cache. 



-- 
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: commits-unsubscr...@gravitino.apache.org

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

Reply via email to