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(org.elasticsearch.common.unit.TimeValue expireAfterAccess)Sets the amount of time before an entry in the cache expires after it was last accessed.CacheBuilder<K,V>setExpireAfterWrite(org.elasticsearch.common.unit.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)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
builder
-
setMaximumWeight
-
setExpireAfterAccess
public CacheBuilder<K,V> setExpireAfterAccess(org.elasticsearch.common.unit.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(org.elasticsearch.common.unit.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
-
removalListener
-
build
-