Class DistributedCacheConfig.Builder

java.lang.Object
cloud.opencode.base.cache.distributed.DistributedCacheConfig.Builder
Enclosing class:
DistributedCacheConfig

public static final class DistributedCacheConfig.Builder extends Object
Builder for DistributedCacheConfig. DistributedCacheConfig 构建器。
Since:
JDK 25, opencode-base-cache V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Method Details

    • name

      Sets the cache name. 设置缓存名称。
      Parameters:
      name - the name | name
      Returns:
      the result | 结果
    • keyPrefix

      public DistributedCacheConfig.Builder keyPrefix(String keyPrefix)
      Sets the key prefix for all keys. 设置所有键的前缀。
      Parameters:
      keyPrefix - the keyPrefix | keyPrefix
      Returns:
      the result | 结果
    • defaultTtl

      public DistributedCacheConfig.Builder defaultTtl(Duration defaultTtl)
      Sets the default TTL for entries. 设置条目的默认 TTL。
      Parameters:
      defaultTtl - the defaultTtl | defaultTtl
      Returns:
      the result | 结果
    • connectionTimeout

      public DistributedCacheConfig.Builder connectionTimeout(Duration connectionTimeout)
      Sets the connection timeout. 设置连接超时。
      Parameters:
      connectionTimeout - the connectionTimeout | connectionTimeout
      Returns:
      the result | 结果
    • operationTimeout

      public DistributedCacheConfig.Builder operationTimeout(Duration operationTimeout)
      Sets the operation timeout. 设置操作超时。
      Parameters:
      operationTimeout - the operationTimeout | operationTimeout
      Returns:
      the result | 结果
    • maxRetries

      public DistributedCacheConfig.Builder maxRetries(int maxRetries)
      Sets the maximum retry count. 设置最大重试次数。
      Parameters:
      maxRetries - the maxRetries | maxRetries
      Returns:
      the result | 结果
    • retryBackoff

      public DistributedCacheConfig.Builder retryBackoff(Duration retryBackoff)
      Sets the retry backoff duration. 设置重试退避时间。
      Parameters:
      retryBackoff - the retryBackoff | retryBackoff
      Returns:
      the result | 结果
    • enableCompression

      public DistributedCacheConfig.Builder enableCompression(boolean enable)
      Enables value compression. 启用值压缩。
      Parameters:
      enable - the enable | enable
      Returns:
      the result | 结果
    • compressionThreshold

      public DistributedCacheConfig.Builder compressionThreshold(int threshold)
      Sets the compression threshold (bytes). 设置压缩阈值(字节)。
      Parameters:
      threshold - the threshold | threshold
      Returns:
      the result | 结果
    • enableStats

      public DistributedCacheConfig.Builder enableStats(boolean enable)
      Enables statistics collection. 启用统计收集。
      Parameters:
      enable - the enable | enable
      Returns:
      the result | 结果
    • enableLocalCache

      public DistributedCacheConfig.Builder enableLocalCache(boolean enable)
      Enables local (L1) caching. 启用本地(L1)缓存。
      Parameters:
      enable - the enable | enable
      Returns:
      the result | 结果
    • localCacheSize

      public DistributedCacheConfig.Builder localCacheSize(int size)
      Sets the local cache size. 设置本地缓存大小。
      Parameters:
      size - the size | size
      Returns:
      the result | 结果
    • localCacheTtl

      public DistributedCacheConfig.Builder localCacheTtl(Duration ttl)
      Sets the local cache TTL. 设置本地缓存 TTL。
      Parameters:
      ttl - the ttl | ttl
      Returns:
      the result | 结果
    • keySerializer

      public DistributedCacheConfig.Builder keySerializer(CacheSerializer<?> serializer)
      Sets the key serializer. 设置键序列化器。
      Parameters:
      serializer - the serializer | serializer
      Returns:
      the result | 结果
    • valueSerializer

      public DistributedCacheConfig.Builder valueSerializer(CacheSerializer<?> serializer)
      Sets the value serializer. 设置值序列化器。
      Parameters:
      serializer - the serializer | serializer
      Returns:
      the result | 结果
    • invalidationChannel

      public DistributedCacheConfig.Builder invalidationChannel(String channel)
      Sets the invalidation channel for pub/sub. 设置发布/订阅的失效频道。
      Parameters:
      channel - the channel | channel
      Returns:
      the result | 结果
    • build

      public DistributedCacheConfig build()
      Builds the config. 构建配置。
      Returns:
      the result | 结果