Class CacheWarmer.Builder<K,V>

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

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

    • Builder

      public Builder()
      Creates a new Builder instance | 创建新的构建器实例
  • Method Details

    • cache

      public CacheWarmer.Builder<K,V> cache(Cache<K,V> cache)
      Sets the cache | 设置缓存
      Parameters:
      cache - the cache | 缓存
      Returns:
      this builder | 此构建器
    • loader

      public CacheWarmer.Builder<K,V> loader(Function<K,V> loader)
      Sets the loader function | 设置加载函数
      Parameters:
      loader - the loader | 加载器
      Returns:
      this builder | 此构建器
    • batchLoader

      public CacheWarmer.Builder<K,V> batchLoader(Function<Set<K>,Map<K,V>> batchLoader)
      Sets the batch loader function | 设置批量加载函数
      Parameters:
      batchLoader - the batch loader | 批量加载器
      Returns:
      this builder | 此构建器
    • batchSize

      public CacheWarmer.Builder<K,V> batchSize(int size)
      Sets the batch size | 设置批量大小
      Parameters:
      size - the batch size | 批量大小
      Returns:
      this builder | 此构建器
    • parallelism

      public CacheWarmer.Builder<K,V> parallelism(int parallelism)
      Sets the parallelism level | 设置并行度
      Parameters:
      parallelism - the parallelism | 并行度
      Returns:
      this builder | 此构建器
    • eventHandler

      public CacheWarmer.Builder<K,V> eventHandler(CacheWarmer.WarmingEventHandler<K,V> handler)
      Sets the event handler | 设置事件处理器
      Parameters:
      handler - the handler | 处理器
      Returns:
      this builder | 此构建器
    • build

      public CacheWarmer<K,V> build()
      Builds the CacheWarmer | 构建缓存预热器
      Returns:
      the cache warmer | 缓存预热器