public class CacheBuilder<K,V>
extends java.lang.Object
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) |
public static <K,V> CacheBuilder<K,V> builder()
public CacheBuilder<K,V> setMaximumWeight(long maximumWeight)
public CacheBuilder<K,V> setExpireAfterAccess(TimeValue expireAfterAccess)
expireAfterAccess
- The amount of time before an entry expires after it was last accessed. Must not be null
and must
be greater than 0.public CacheBuilder<K,V> setExpireAfterWrite(TimeValue expireAfterWrite)
expireAfterWrite
- The amount of time before an entry expires after it was written. Must not be null
and must be
greater than 0.public CacheBuilder<K,V> weigher(java.util.function.ToLongBiFunction<K,V> weigher)
public CacheBuilder<K,V> removalListener(RemovalListener<K,V> removalListener)