Class VariableTtlCache.Builder<K,V>

java.lang.Object
cloud.opencode.base.cache.ttl.VariableTtlCache.Builder<K,V>
Type Parameters:
K - key type | 键类型
V - value type | 值类型
Enclosing class:
VariableTtlCache<K,V>

public static class VariableTtlCache.Builder<K,V> extends Object
Builder for VariableTtlCache VariableTtlCache 构建器
Since:
JDK 25, opencode-base-cache V2.0.5
Author:
Leon Soo www.LeonSoo.com
  • Method Details

    • ttlPolicy

      public VariableTtlCache.Builder<K,V> ttlPolicy(TtlPolicy<K,V> policy)
      Set TTL policy 设置 TTL 策略
      Parameters:
      policy - the TTL policy | TTL 策略
      Returns:
      this builder | 此构建器
    • decayPolicy

      public VariableTtlCache.Builder<K,V> decayPolicy(TtlDecayPolicy policy)
      Set TTL decay policy 设置 TTL 衰减策略
      Parameters:
      policy - the decay policy | 衰减策略
      Returns:
      this builder | 此构建器
    • trackAccess

      public VariableTtlCache.Builder<K,V> trackAccess()
      Enable access tracking (automatically enabled with decay) 启用访问跟踪(使用衰减时自动启用)
      Returns:
      this builder | 此构建器
    • build

      public VariableTtlCache<K,V> build()
      Build the variable TTL cache 构建可变 TTL 缓存
      Returns:
      variable TTL cache | 可变 TTL 缓存