Package org.elasticsearch.common.cache
Class CacheBuilder<K,V>
- java.lang.Object
-
- org.elasticsearch.common.cache.CacheBuilder<K,V>
-
public class CacheBuilder<K,V> extends java.lang.Object
-
-
Method Summary
Modifier and Type Method Description Cache<K,V>build()static <K,V>
CacheBuilder<K,V>builder()CacheBuilder<K,V>removalListener(RemovalListener<K,V> removalListener)CacheBuilder<K,V>setExpireAfterAccess(TimeValue expireAfterAccess)Sets the amount of time before an entry in the cache expires after it was last accessed.CacheBuilder<K,V>setExpireAfterWrite(TimeValue expireAfterWrite)Sets the amount of time before an entry in the cache expires after it was written.CacheBuilder<K,V>setMaximumWeight(long maximumWeight)CacheBuilder<K,V>weigher(java.util.function.ToLongBiFunction<K,V> weigher)
-
-
-
Method Detail
-
builder
public static <K,V> CacheBuilder<K,V> builder()
-
setMaximumWeight
public CacheBuilder<K,V> setMaximumWeight(long maximumWeight)
-
setExpireAfterAccess
public CacheBuilder<K,V> setExpireAfterAccess(TimeValue expireAfterAccess)
Sets the amount of time before an entry in the cache expires after it was last accessed.- Parameters:
expireAfterAccess- The amount of time before an entry expires after it was last accessed. Must not benulland must be greater than 0.
-
setExpireAfterWrite
public CacheBuilder<K,V> setExpireAfterWrite(TimeValue expireAfterWrite)
Sets the amount of time before an entry in the cache expires after it was written.- Parameters:
expireAfterWrite- The amount of time before an entry expires after it was written. Must not benulland must be greater than 0.
-
weigher
public CacheBuilder<K,V> weigher(java.util.function.ToLongBiFunction<K,V> weigher)
-
removalListener
public CacheBuilder<K,V> removalListener(RemovalListener<K,V> removalListener)
-
-