Class CacheDecorators.ChainBuilder<K,V>
java.lang.Object
cloud.opencode.base.cache.CacheDecorators.ChainBuilder<K,V>
- Type Parameters:
K- key type | 键类型V- value type | 值类型
- Enclosing class:
CacheDecorators
Builder for chaining cache decorators
用于链式组合缓存装饰器的构建器
- Since:
- JDK 25, opencode-base-cache V2.0.2
- Author:
- Leon Soo www.LeonSoo.com
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Build the decorated cache 构建装饰后的缓存with(UnaryOperator<Cache<K, V>> decorator) Apply a custom decorator 应用自定义装饰器Add copy-on-read behavior with default copier (serialization) 添加读时复制行为,使用默认复制器(序列化)withCopyOnRead(UnaryOperator<V> copier) Add copy-on-read with custom copier 添加读时复制并自定义复制器withCopyOnReadConfigured(UnaryOperator<CopyOnReadCache.Builder<K, V>> configurer) Add copy-on-read with custom configuration 添加读时复制并自定义配置Add protection (BloomFilter + SingleFlight) with default settings 添加保护(布隆过滤器 + SingleFlight)使用默认设置withProtection(UnaryOperator<ProtectedCache.Builder<K, V>> configurer) Add protection with custom configuration 添加保护并自定义配置withRefreshAhead(RefreshAheadPolicy<K, V> policy, Function<? super K, ? extends V> loader) Add refresh-ahead behavior 添加提前刷新行为withRefreshAhead(UnaryOperator<RefreshAheadCache.Builder<K, V>> configurer) Add refresh-ahead with custom configuration 添加提前刷新并自定义配置withTimeout(Duration timeout) Add operation timeout 添加操作超时withTimeout(UnaryOperator<TimeoutCache.Builder<K, V>> configurer) Add timeout with custom configuration 添加超时并自定义配置
-
Method Details
-
withProtection
Add protection (BloomFilter + SingleFlight) with default settings 添加保护(布隆过滤器 + SingleFlight)使用默认设置- Returns:
- this builder | 此构建器
-
withProtection
public CacheDecorators.ChainBuilder<K,V> withProtection(UnaryOperator<ProtectedCache.Builder<K, V>> configurer) Add protection with custom configuration 添加保护并自定义配置- Parameters:
configurer- configuration function | 配置函数- Returns:
- this builder | 此构建器
-
withRefreshAhead
public CacheDecorators.ChainBuilder<K,V> withRefreshAhead(RefreshAheadPolicy<K, V> policy, Function<? super K, ? extends V> loader) Add refresh-ahead behavior 添加提前刷新行为- Parameters:
policy- the refresh policy | 刷新策略loader- the value loader | 值加载器- Returns:
- this builder | 此构建器
-
withRefreshAhead
public CacheDecorators.ChainBuilder<K,V> withRefreshAhead(UnaryOperator<RefreshAheadCache.Builder<K, V>> configurer) Add refresh-ahead with custom configuration 添加提前刷新并自定义配置- Parameters:
configurer- configuration function | 配置函数- Returns:
- this builder | 此构建器
-
withTimeout
Add operation timeout 添加操作超时- Parameters:
timeout- the timeout duration | 超时时长- Returns:
- this builder | 此构建器
-
withTimeout
public CacheDecorators.ChainBuilder<K,V> withTimeout(UnaryOperator<TimeoutCache.Builder<K, V>> configurer) Add timeout with custom configuration 添加超时并自定义配置- Parameters:
configurer- configuration function | 配置函数- Returns:
- this builder | 此构建器
-
withCopyOnRead
Add copy-on-read behavior with default copier (serialization) 添加读时复制行为,使用默认复制器(序列化)- Returns:
- this builder | 此构建器
-
withCopyOnRead
Add copy-on-read with custom copier 添加读时复制并自定义复制器- Parameters:
copier- the value copier function | 值复制函数- Returns:
- this builder | 此构建器
-
withCopyOnReadConfigured
public CacheDecorators.ChainBuilder<K,V> withCopyOnReadConfigured(UnaryOperator<CopyOnReadCache.Builder<K, V>> configurer) Add copy-on-read with custom configuration 添加读时复制并自定义配置- Parameters:
configurer- configuration function | 配置函数- Returns:
- this builder | 此构建器
-
with
Apply a custom decorator 应用自定义装饰器- Parameters:
decorator- the decorator function | 装饰器函数- Returns:
- this builder | 此构建器
-
build
-