Class WriteThroughCache.Builder<K,V>
java.lang.Object
cloud.opencode.base.cache.WriteThroughCache.Builder<K,V>
- Type Parameters:
K- key type | 键类型V- value type | 值类型
- Enclosing class:
WriteThroughCache<K,V>
Builder for WriteThroughCache
WriteThroughCache 构建器
- Since:
- JDK 25, opencode-base-cache V2.0.4
- Author:
- Leon Soo www.LeonSoo.com
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Build the write-through cache 构建写穿透缓存Set the deleter for cache invalidation 设置删除器用于缓存失效onError(BiConsumer<Iterable<K>, Throwable> errorHandler) Set error handler for write failures 设置写入失败的错误处理器writer(WriteThroughCache.CacheWriter<K, V> writer) Set the cache writer with full control 设置完整控制的缓存写入器writer(BiConsumer<K, V> writer) Set the cache writer for single entry writes 设置单条目写入器
-
Method Details
-
writer
Set the cache writer for single entry writes 设置单条目写入器- Parameters:
writer- the writer function | 写入函数- Returns:
- this builder | 此构建器
-
writer
Set the cache writer with full control 设置完整控制的缓存写入器- Parameters:
writer- the cache writer | 缓存写入器- Returns:
- this builder | 此构建器
-
deleter
Set the deleter for cache invalidation 设置删除器用于缓存失效- Parameters:
deleter- the deleter function | 删除函数- Returns:
- this builder | 此构建器
-
onError
Set error handler for write failures 设置写入失败的错误处理器- Parameters:
errorHandler- the error handler | 错误处理器- Returns:
- this builder | 此构建器
-
build
Build the write-through cache 构建写穿透缓存- Returns:
- write-through cache | 写穿透缓存
-