Class OpenCache.CacheBuilder<K,V>
java.lang.Object
cloud.opencode.base.cache.OpenCache.CacheBuilder<K,V>
- Type Parameters:
K- key type | 键类型V- value type | 值类型
- Enclosing class:
OpenCache
Cache Builder - Fluent API for building caches
缓存构建器 - 用于构建缓存的流式 API
- Since:
- JDK 25, opencode-base-cache V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Build anonymous cache 构建匿名缓存Build cache with name 构建命名缓存evictionPolicy(EvictionPolicy<K, V> policy) Sets the eviction policy | 设置淘汰策略expireAfterAccess(Duration duration) expireAfterAccess | expireAfterAccessexpireAfterWrite(Duration duration) expireAfterWrite | expireAfterWriteexpiryPolicy(ExpiryPolicy<K, V> policy) Sets the expiry policy | 设置过期策略maximumSize(long size) maximumSize | maximumSizemaximumWeight(long weight) maximumWeight | maximumWeightrecordStats | recordStatsuseVirtualThreads | useVirtualThreads
-
Constructor Details
-
CacheBuilder
public CacheBuilder()Creates a new CacheBuilder instance | 创建新的 CacheBuilder 实例
-
-
Method Details
-
maximumSize
maximumSize | maximumSize- Parameters:
size- the size | size- Returns:
- the result | 结果
-
maximumWeight
maximumWeight | maximumWeight- Parameters:
weight- the weight | weight- Returns:
- the result | 结果
-
expireAfterWrite
expireAfterWrite | expireAfterWrite- Parameters:
duration- the duration | duration- Returns:
- the result | 结果
-
expireAfterAccess
expireAfterAccess | expireAfterAccess- Parameters:
duration- the duration | duration- Returns:
- the result | 结果
-
evictionPolicy
Sets the eviction policy | 设置淘汰策略- Parameters:
policy- the eviction policy | 淘汰策略- Returns:
- this builder | 此构建器
-
expiryPolicy
Sets the expiry policy | 设置过期策略- Parameters:
policy- the expiry policy | 过期策略- Returns:
- this builder | 此构建器
-
recordStats
-
useVirtualThreads
useVirtualThreads | useVirtualThreads- Returns:
- the result | 结果
-
build
-
build
-