类 CacheBuilder<K,V>

java.lang.Object
com.alibaba.nacos.common.cache.builder.CacheBuilder<K,V>

public class CacheBuilder<K,V> extends Object
Cache builder.
作者:
zzq
  • 构造器详细资料

    • CacheBuilder

      public CacheBuilder()
  • 方法详细资料

    • builder

      public static <K, V> CacheBuilder<K,V> builder()
    • expireNanos

      public CacheBuilder<K,V> expireNanos(long duration, TimeUnit unit)
      Set expiration time.
    • maximumSize

      public CacheBuilder<K,V> maximumSize(int maximumSize)
      Set the maximum capacity of the cache pair.
      参数:
      maximumSize - maximum capacity
    • sync

      public CacheBuilder<K,V> sync(boolean sync)
      Set whether the cache method is synchronized.
      参数:
      sync - if sync value is true, each method of the constructed cache is synchronized.
    • lru

      public CacheBuilder<K,V> lru(boolean lru)
      Does the constructed cache support lru.
      参数:
      lru - If the cache built for true is an lru cache.
    • initializeCapacity

      public CacheBuilder<K,V> initializeCapacity(int initializeCapacity)
      Set the initial capacity of the cache pair.
      参数:
      initializeCapacity - initialize capacity
    • build

      public Cache<K,V> build()
      Build the cache according to the builder attribute.