yuqi1129 commented on code in PR #6569: URL: https://github.com/apache/gravitino/pull/6569#discussion_r1986706993
########## 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: I'm unsure if it's necessary to clear the static cache from instances. for the catalog, the `cacheCache` is a class field, and clearing it is okay. -- 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