in cfg/rationalize.go [42:65]
func resolveMetadataCacheTTL(v isSet, c *MetadataCacheConfig, optimizedFlags []string) {
optimizationAppliedToNegativeCacheTTL := isFlagPresent(optimizedFlags, MetadataNegativeCacheTTLConfigKey)
if v.IsSet(MetadataNegativeCacheTTLConfigKey) || optimizationAppliedToNegativeCacheTTL {
if c.NegativeTtlSecs == -1 {
c.NegativeTtlSecs = maxSupportedTTLInSeconds
}
}
// Order of precedence for setting TTL seconds
// 1. If metadata-cache:ttl-secs has been set, then it has highest precedence
// 2. If metadata-cache:stat-cache-ttl or metadata-cache:type-cache-ttl has been set or no optimization applied, then it has second highest precedence
// 3. Optimization is applied (implicit) and take care of special case of -1 which can occur even in defaults
optimizationAppliedToMetadataCacheTTL := isFlagPresent(optimizedFlags, MetadataCacheTTLConfigKey)
if v.IsSet(MetadataCacheTTLConfigKey) {
if c.TtlSecs == -1 {
c.TtlSecs = maxSupportedTTLInSeconds
}
} else if (v.IsSet(MetadataCacheStatCacheTTLConfigKey) || v.IsSet(MetadataCacheTypeCacheTTLConfigKey)) || (!optimizationAppliedToMetadataCacheTTL) {
c.TtlSecs = int64(math.Ceil(math.Min(c.DeprecatedStatCacheTtl.Seconds(), c.DeprecatedTypeCacheTtl.Seconds())))
} else if c.TtlSecs == -1 {
c.TtlSecs = maxSupportedTTLInSeconds
}
}