Abyss-lord commented on code in PR #7200:
URL: https://github.com/apache/gravitino/pull/7200#discussion_r2103633022


##########
core/src/main/java/org/apache/gravitino/cache/CacheConfig.java:
##########
@@ -0,0 +1,187 @@
+/*
+ * 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.gravitino.cache;
+
+/*
+ * 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.
+ */
+
+import java.util.concurrent.TimeUnit;
+import org.apache.gravitino.Config;
+import org.apache.gravitino.config.ConfigBuilder;
+import org.apache.gravitino.config.ConfigConstants;
+import org.apache.gravitino.config.ConfigEntry;
+
+/**
+ * Cache configuration class, inheriting from Config. This class defines 
configuration entries
+ * related to caching, including whether to use a weighted cache, cache size 
limits, and cache
+ * expiration settings.
+ */
+public class CacheConfig extends Config {
+
+  // Maximum number of entries in the cache
+  public static final ConfigEntry<Integer> CACHE_MAX_SIZE =
+      new ConfigBuilder("gravitino.server.cache.max.size")
+          .doc("The max size of the cache in number of entries.")
+          .version(ConfigConstants.VERSION_0_10_0)
+          .intConf()
+          .checkValue(value -> value > 0, 
ConfigConstants.POSITIVE_NUMBER_ERROR_MSG)
+          .createWithDefault(10_000);
+
+  // Whether to enable cache expiration
+  public static final ConfigEntry<Boolean> CACHE_EXPIRATION_ENABLED =
+      new ConfigBuilder("gravitino.server.cache.expiration.enabled")
+          .doc("Whether to enable cache expiration.")
+          .version(ConfigConstants.VERSION_0_10_0)
+          .booleanConf()
+          .createWithDefault(true);
+
+  // Cache entry expiration time
+  public static final ConfigEntry<Long> CACHE_EXPIRATION_TIME =
+      new ConfigBuilder("gravitino.server.cache.expiration.time")
+          .doc("The time after which cache entries expire. default is 60 
minutes.")
+          .version(ConfigConstants.VERSION_0_10_0)
+          .longConf()
+          .checkValue(value -> value > 0, 
ConfigConstants.POSITIVE_NUMBER_ERROR_MSG)
+          .createWithDefault(60L);
+
+  // Whether to enable cache status
+  public static final ConfigEntry<Boolean> CACHE_STATUS_ENABLED =
+      new ConfigBuilder("gravitino.server.cache.status.log.enabled")
+          .doc(
+              "Whether to collect and log cache status. if enabled, cache 
status will be collected and logged.")
+          .version(ConfigConstants.VERSION_0_10_0)
+          .booleanConf()
+          .createWithDefault(false);
+
+  // Whether to enable weighted cache
+  public static final ConfigEntry<Boolean> CACHE_WEIGHER_ENABLED =
+      new ConfigBuilder("gravitino.server.cache.weigher.enabled")
+          .doc(
+              "Whether to enable weighted cache. if enabled, cache entries 
will be weighed based on their weight, not"
+                  + " size.")
+          .version(ConfigConstants.VERSION_0_10_0)
+          .booleanConf()
+          .createWithDefault(true);
+
+  // Maximum weight of cache entries
+  public static final ConfigEntry<Long> CACHE_MAX_WEIGHT =
+      new ConfigBuilder("gravitino.server.cache.max.weight")
+          .doc("The maximum weight of cache entries. default is 10000.")
+          .version(ConfigConstants.VERSION_0_10_0)
+          .longConf()
+          .checkValue(value -> value > 0, 
ConfigConstants.POSITIVE_NUMBER_ERROR_MSG)
+          .createWithDefault(EntityCacheWeigher.getMaxWeight());

Review Comment:
   I already remove this configuration.



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