Class ReadThroughCache.Builder<K,V>
java.lang.Object
cloud.opencode.base.cache.ReadThroughCache.Builder<K,V>
- Type Parameters:
K- key type | 键类型V- value type | 值类型
- Enclosing class:
ReadThroughCache<K,V>
Builder for ReadThroughCache
ReadThroughCache 构建器
- Since:
- JDK 25, opencode-base-cache V2.0.4
- Author:
- Leon Soo www.LeonSoo.com
-
Method Summary
Modifier and TypeMethodDescriptionSet the batch loader function 设置批量加载函数build()Build the read-through cache 构建读穿透缓存Enable caching of null values (using fallback as marker) 启用缓存 null 值(使用降级值作为标记)Set the fallback function for when loading returns null 设置加载返回 null 时的降级函数Set a static fallback value 设置静态降级值loader(CacheLoader<K, V> loader) Set the loader using CacheLoader interface 使用 CacheLoader 接口设置加载器Set the loader function for single key loading 设置单键加载函数
-
Method Details
-
loader
-
loader
Set the loader using CacheLoader interface 使用 CacheLoader 接口设置加载器- Parameters:
loader- the cache loader | 缓存加载器- Returns:
- this builder | 此构建器
-
batchLoader
-
fallback
-
fallback
Set a static fallback value 设置静态降级值- Parameters:
fallbackValue- the fallback value | 降级值- Returns:
- this builder | 此构建器
-
cacheNullValues
Enable caching of null values (using fallback as marker) 启用缓存 null 值(使用降级值作为标记)- Returns:
- this builder | 此构建器
-
build
Build the read-through cache 构建读穿透缓存- Returns:
- read-through cache | 读穿透缓存
-