jerryshao commented on code in PR #7354:
URL: https://github.com/apache/gravitino/pull/7354#discussion_r2139176926


##########
core/src/main/java/org/apache/gravitino/storage/relational/RelationalEntityStore.java:
##########
@@ -54,12 +60,30 @@ public class RelationalEntityStore
           Configs.DEFAULT_ENTITY_RELATIONAL_STORE, 
JDBCBackend.class.getCanonicalName());
   private RelationalBackend backend;
   private RelationalGarbageCollector garbageCollector;
+  private EntityCache cache;
+  private Set<Namespace> namespaceSet;
+  private boolean cacheEnabled;
+
+  /**
+   * Return whether the cache is enabled or not.
+   *
+   * @return {@code true} if cache is enable, otherwise {@code false}
+   */
+  public boolean cacheEnabled() {
+    return cacheEnabled;
+  }
 
   @Override
   public void initialize(Config config) throws RuntimeException {
     this.backend = createRelationalEntityBackend(config);
     this.garbageCollector = new RelationalGarbageCollector(backend, config);
     this.garbageCollector.start();
+    this.cacheEnabled = config.get(Configs.CACHE_ENABLED);
+    // TODO USE SPI to load the cache
+    if (cacheEnabled) {
+      this.cache = new CaffeineEntityCache(config);
+      this.namespaceSet = Sets.newHashSet();
+    }

Review Comment:
   I think it is better to have a `NoOpsCache` if cache is not enabled, so you 
don't have to add lots of "if conditions" to check whether the cache is enabled 
or not. 



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