类 CacheBuilder<K,V>
- java.lang.Object
-
- com.alibaba.nacos.common.cache.builder.CacheBuilder<K,V>
-
public class CacheBuilder<K,V> extends java.lang.ObjectCache builder.- 作者:
- zzq
-
-
字段概要
字段 修饰符和类型 字段 说明 private static intDEFAULT_EXPIRE_NANOSprivate static intDEFAULT_INITIALIZE_CAPACITYprivate static intDEFAULT_MAXIMUMSIZEprivate longexpireNanosprivate intinitializeCapacityprivate booleanlruprivate intmaximumSizeprivate booleansync
-
构造器概要
构造器 构造器 说明 CacheBuilder()
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 Cache<K,V>build()Build the cache according to the builder attribute.static <K,V>
CacheBuilder<K,V>builder()private voidcheckExpireNanos(long duration, java.util.concurrent.TimeUnit unit)CacheBuilder<K,V>expireNanos(long duration, java.util.concurrent.TimeUnit unit)Set expiration time.CacheBuilder<K,V>initializeCapacity(int initializeCapacity)Set the initial capacity of the cache pair.CacheBuilder<K,V>lru(boolean lru)Does the constructed cache support lru.CacheBuilder<K,V>maximumSize(int maximumSize)Set the maximum capacity of the cache pair.CacheBuilder<K,V>sync(boolean sync)Set whether the cache method is synchronized.
-
-
-
字段详细资料
-
DEFAULT_MAXIMUMSIZE
private static final int DEFAULT_MAXIMUMSIZE
- 另请参阅:
- 常量字段值
-
DEFAULT_INITIALIZE_CAPACITY
private static final int DEFAULT_INITIALIZE_CAPACITY
- 另请参阅:
- 常量字段值
-
DEFAULT_EXPIRE_NANOS
private static final int DEFAULT_EXPIRE_NANOS
- 另请参阅:
- 常量字段值
-
expireNanos
private long expireNanos
-
maximumSize
private int maximumSize
-
initializeCapacity
private int initializeCapacity
-
sync
private boolean sync
-
lru
private boolean lru
-
-
方法详细资料
-
builder
public static <K,V> CacheBuilder<K,V> builder()
-
expireNanos
public CacheBuilder<K,V> expireNanos(long duration, java.util.concurrent.TimeUnit unit)
Set expiration time.
-
checkExpireNanos
private void checkExpireNanos(long duration, java.util.concurrent.TimeUnit unit)
-
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
-
-