morningman commented on code in PR #60478:
URL: https://github.com/apache/doris/pull/60478#discussion_r2786770023
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalCatalog.java:
##########
@@ -123,6 +123,38 @@ public abstract class ExternalCatalog
// 0 means cache is disabled; >0 means cache with ttl;
public static final int CACHE_TTL_DISABLE_CACHE = 0;
+ public static CacheTtlSpec resolveCacheTtlSpec(String ttlValue, long
defaultExpireSeconds, long maxSize) {
+ if (ttlValue == null) {
+ return new CacheTtlSpec(OptionalLong.of(defaultExpireSeconds),
maxSize);
+ }
+ long ttlSeconds = NumberUtils.toLong(ttlValue, CACHE_NO_TTL);
+ if (ttlSeconds == CACHE_NO_TTL) {
+ return new CacheTtlSpec(OptionalLong.empty(), maxSize);
+ }
+ if (ttlSeconds == CACHE_TTL_DISABLE_CACHE) {
+ return new CacheTtlSpec(OptionalLong.of(0), 0);
+ }
+ return new CacheTtlSpec(OptionalLong.of(ttlSeconds), maxSize);
+ }
+
+ public static class CacheTtlSpec {
Review Comment:
Can this be moved to CacheSpec.java?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]