dimas-b commented on code in PR #1193:
URL: https://github.com/apache/polaris/pull/1193#discussion_r2055060016


##########
polaris-core/src/testFixtures/java/org/apache/polaris/core/persistence/BaseResolverTest.java:
##########
@@ -57,7 +57,7 @@ public abstract class BaseResolverTest {
   protected PolarisBaseEntity P1;
 
   // cache we are using
-  protected EntityCache cache;
+  protected InMemoryEntityCache cache;

Review Comment:
   Why require a specific sub-type here?



##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/cache/InMemoryEntityCache.java:
##########
@@ -0,0 +1,481 @@
+/*
+ * 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.polaris.core.persistence.cache;
+
+import com.github.benmanes.caffeine.cache.Cache;
+import com.github.benmanes.caffeine.cache.Caffeine;
+import com.github.benmanes.caffeine.cache.RemovalListener;
+import jakarta.annotation.Nonnull;
+import jakarta.annotation.Nullable;
+import java.util.AbstractMap;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.TimeUnit;
+import org.apache.polaris.core.PolarisCallContext;
+import org.apache.polaris.core.config.BehaviorChangeConfiguration;
+import org.apache.polaris.core.config.FeatureConfiguration;
+import org.apache.polaris.core.config.PolarisConfiguration;
+import org.apache.polaris.core.entity.PolarisBaseEntity;
+import org.apache.polaris.core.entity.PolarisEntityType;
+import org.apache.polaris.core.entity.PolarisGrantRecord;
+import org.apache.polaris.core.persistence.PolarisMetaStoreManager;
+import org.apache.polaris.core.persistence.ResolvedPolarisEntity;
+import org.apache.polaris.core.persistence.dao.entity.ResolvedEntityResult;
+
+/** An in-memory entity cache with a limit of 100k entities and a 1h TTL. */
+public class InMemoryEntityCache implements EntityCache {

Review Comment:
   Seeing this as a new file in diff is odd... Could you be handled as a rename 
of the old `EntityCache` file?



##########
polaris-core/src/test/java/org/apache/polaris/core/persistence/cache/EntityCacheTest.java:
##########
@@ -102,14 +102,14 @@ public EntityCacheTest() {
   /**
    * @return new cache for the entity store
    */
-  EntityCache allocateNewCache() {
-    return new EntityCache(this.metaStoreManager);
+  InMemoryEntityCache allocateNewCache() {
+    return new InMemoryEntityCache(this.metaStoreManager);
   }
 
   @Test
   void testGetOrLoadEntityByName() {
     // get a new cache
-    EntityCache cache = this.allocateNewCache();
+    InMemoryEntityCache cache = this.allocateNewCache();

Review Comment:
   Why do we need to use a specific sub-type here?



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