Class ProtectedCache.Builder<K,V>
java.lang.Object
cloud.opencode.base.cache.ProtectedCache.Builder<K,V>
- Type Parameters:
K- the key type | 键类型V- the value type | 值类型
- Enclosing class:
ProtectedCache<K,V>
Builder for ProtectedCache
- Since:
- JDK 25, opencode-base-cache V2.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Method Summary
Modifier and TypeMethodDescriptionbloomFilter(boolean enable) Enable/disable bloom filter 启用/禁用布隆过滤器bloomFilter(long expectedInsertions, double falsePositiveRate) Configure bloom filter 配置布隆过滤器build()Build the protected cache 构建保护缓存negativeCache(Duration duration) Set negative cache duration 设置负缓存时长singleFlight(boolean enable) Enable/disable single flight 启用/禁用单次加载
-
Method Details
-
bloomFilter
Enable/disable bloom filter 启用/禁用布隆过滤器- Parameters:
enable- the enable | enable- Returns:
- the result | 结果
-
bloomFilter
Configure bloom filter 配置布隆过滤器- Parameters:
expectedInsertions- expected number of insertions | 预期插入数falsePositiveRate- false positive rate (0-1) | 误报率- Returns:
- the result | 结果
-
singleFlight
Enable/disable single flight 启用/禁用单次加载- Parameters:
enable- the enable | enable- Returns:
- the result | 结果
-
negativeCache
Set negative cache duration 设置负缓存时长- Parameters:
duration- how long to cache negative lookups | 负查找缓存时长- Returns:
- the result | 结果
-
build
-