Class RefreshAheadCache.Builder<K,V>

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

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

    • refreshPolicy

      public RefreshAheadCache.Builder<K,V> refreshPolicy(RefreshAheadPolicy<K,V> policy)
      Set refresh policy 设置刷新策略
      Parameters:
      policy - the refresh policy | 刷新策略
      Returns:
      this builder | 此构建器
    • loader

      public RefreshAheadCache.Builder<K,V> loader(Function<? super K, ? extends V> loader)
      Set loader function for refreshing values 设置用于刷新值的加载函数
      Parameters:
      loader - the loader | 加载器
      Returns:
      this builder | 此构建器
    • executor

      public RefreshAheadCache.Builder<K,V> executor(Executor executor)
      Set executor for async refresh 设置异步刷新执行器
      Parameters:
      executor - the executor | 执行器
      Returns:
      this builder | 此构建器
    • ttl

      Set TTL for refresh calculation 设置刷新计算的 TTL
      Parameters:
      ttl - the TTL | TTL
      Returns:
      this builder | 此构建器
    • build

      public RefreshAheadCache<K,V> build()
      Build the refresh-ahead cache 构建提前刷新缓存
      Returns:
      refresh-ahead cache | 提前刷新缓存