Class DistributedCacheConfig.Builder
java.lang.Object
cloud.opencode.base.cache.distributed.DistributedCacheConfig.Builder
- Enclosing class:
DistributedCacheConfig
Builder for DistributedCacheConfig.
DistributedCacheConfig 构建器。
- Since:
- JDK 25, opencode-base-cache V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the config.compressionThreshold(int threshold) Sets the compression threshold (bytes).connectionTimeout(Duration connectionTimeout) Sets the connection timeout.defaultTtl(Duration defaultTtl) Sets the default TTL for entries.enableCompression(boolean enable) Enables value compression.enableLocalCache(boolean enable) Enables local (L1) caching.enableStats(boolean enable) Enables statistics collection.invalidationChannel(String channel) Sets the invalidation channel for pub/sub.Sets the key prefix for all keys.keySerializer(CacheSerializer<?> serializer) Sets the key serializer.localCacheSize(int size) Sets the local cache size.localCacheTtl(Duration ttl) Sets the local cache TTL.maxRetries(int maxRetries) Sets the maximum retry count.Sets the cache name.operationTimeout(Duration operationTimeout) Sets the operation timeout.retryBackoff(Duration retryBackoff) Sets the retry backoff duration.valueSerializer(CacheSerializer<?> serializer) Sets the value serializer.
-
Method Details
-
name
Sets the cache name. 设置缓存名称。- Parameters:
name- the name | name- Returns:
- the result | 结果
-
keyPrefix
Sets the key prefix for all keys. 设置所有键的前缀。- Parameters:
keyPrefix- the keyPrefix | keyPrefix- Returns:
- the result | 结果
-
defaultTtl
Sets the default TTL for entries. 设置条目的默认 TTL。- Parameters:
defaultTtl- the defaultTtl | defaultTtl- Returns:
- the result | 结果
-
connectionTimeout
Sets the connection timeout. 设置连接超时。- Parameters:
connectionTimeout- the connectionTimeout | connectionTimeout- Returns:
- the result | 结果
-
operationTimeout
Sets the operation timeout. 设置操作超时。- Parameters:
operationTimeout- the operationTimeout | operationTimeout- Returns:
- the result | 结果
-
maxRetries
Sets the maximum retry count. 设置最大重试次数。- Parameters:
maxRetries- the maxRetries | maxRetries- Returns:
- the result | 结果
-
retryBackoff
Sets the retry backoff duration. 设置重试退避时间。- Parameters:
retryBackoff- the retryBackoff | retryBackoff- Returns:
- the result | 结果
-
enableCompression
Enables value compression. 启用值压缩。- Parameters:
enable- the enable | enable- Returns:
- the result | 结果
-
compressionThreshold
Sets the compression threshold (bytes). 设置压缩阈值(字节)。- Parameters:
threshold- the threshold | threshold- Returns:
- the result | 结果
-
enableStats
Enables statistics collection. 启用统计收集。- Parameters:
enable- the enable | enable- Returns:
- the result | 结果
-
enableLocalCache
Enables local (L1) caching. 启用本地(L1)缓存。- Parameters:
enable- the enable | enable- Returns:
- the result | 结果
-
localCacheSize
Sets the local cache size. 设置本地缓存大小。- Parameters:
size- the size | size- Returns:
- the result | 结果
-
localCacheTtl
Sets the local cache TTL. 设置本地缓存 TTL。- Parameters:
ttl- the ttl | ttl- Returns:
- the result | 结果
-
keySerializer
Sets the key serializer. 设置键序列化器。- Parameters:
serializer- the serializer | serializer- Returns:
- the result | 结果
-
valueSerializer
Sets the value serializer. 设置值序列化器。- Parameters:
serializer- the serializer | serializer- Returns:
- the result | 结果
-
invalidationChannel
Sets the invalidation channel for pub/sub. 设置发布/订阅的失效频道。- Parameters:
channel- the channel | channel- Returns:
- the result | 结果
-
build
-