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

@Deprecated(since="1.0.3", forRemoval=true) public static final class OpenCache.CacheBuilder<K,V> extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
Use CacheConfig.Builder instead for full configuration capabilities. 已废弃,请使用 CacheConfig.Builder 以获得完整的配置能力。
Cache Builder - Fluent API for building caches 缓存构建器 - 用于构建缓存的流式 API
Since:
JDK 25, opencode-base-cache V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • CacheBuilder

      public CacheBuilder()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a new CacheBuilder instance | 创建新的 CacheBuilder 实例
  • Method Details

    • maximumSize

      public OpenCache.CacheBuilder<K,V> maximumSize(long size)
      Deprecated, for removal: This API element is subject to removal in a future version.
      maximumSize | maximumSize
      Parameters:
      size - the size | size
      Returns:
      the result | 结果
    • maximumWeight

      public OpenCache.CacheBuilder<K,V> maximumWeight(long weight)
      Deprecated, for removal: This API element is subject to removal in a future version.
      maximumWeight | maximumWeight
      Parameters:
      weight - the weight | weight
      Returns:
      the result | 结果
    • expireAfterWrite

      public OpenCache.CacheBuilder<K,V> expireAfterWrite(Duration duration)
      Deprecated, for removal: This API element is subject to removal in a future version.
      expireAfterWrite | expireAfterWrite
      Parameters:
      duration - the duration | duration
      Returns:
      the result | 结果
    • expireAfterAccess

      public OpenCache.CacheBuilder<K,V> expireAfterAccess(Duration duration)
      Deprecated, for removal: This API element is subject to removal in a future version.
      expireAfterAccess | expireAfterAccess
      Parameters:
      duration - the duration | duration
      Returns:
      the result | 结果
    • evictionPolicy

      public OpenCache.CacheBuilder<K,V> evictionPolicy(EvictionPolicy<K,V> policy)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Sets the eviction policy | 设置淘汰策略
      Parameters:
      policy - the eviction policy | 淘汰策略
      Returns:
      this builder | 此构建器
    • expiryPolicy

      public OpenCache.CacheBuilder<K,V> expiryPolicy(ExpiryPolicy<K,V> policy)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Sets the expiry policy | 设置过期策略
      Parameters:
      policy - the expiry policy | 过期策略
      Returns:
      this builder | 此构建器
    • recordStats

      public OpenCache.CacheBuilder<K,V> recordStats()
      Deprecated, for removal: This API element is subject to removal in a future version.
      recordStats | recordStats
      Returns:
      the result | 结果
    • useVirtualThreads

      public OpenCache.CacheBuilder<K,V> useVirtualThreads()
      Deprecated, for removal: This API element is subject to removal in a future version.
      useVirtualThreads | useVirtualThreads
      Returns:
      the result | 结果
    • build

      public Cache<K,V> build(String name)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Build cache with name 构建命名缓存
      Parameters:
      name - cache name | 缓存名称
      Returns:
      cache instance | 缓存实例
    • build

      public Cache<K,V> build()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Build anonymous cache 构建匿名缓存
      Returns:
      cache instance | 缓存实例