Package cn.sliew.milky.cache.caffeine
Class CaffeineCacheOptions<K,V>
- java.lang.Object
-
- cn.sliew.milky.cache.CacheOptions<K,V>
-
- cn.sliew.milky.cache.caffeine.CaffeineCacheOptions<K,V>
-
public class CaffeineCacheOptions<K,V> extends CacheOptions<K,V>
recordStatsdefaulttrue, can't be disabled.- See Also:
CaffeineSpec
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class cn.sliew.milky.cache.CacheOptions
CacheOptions.WriteMode
-
-
Constructor Summary
Constructors Constructor Description CaffeineCacheOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)CaffeineCacheOptions<K,V>expireAfterAccess(Duration expireAfterAccess)Sets cacheexpireAfterAccess.CaffeineCacheOptions<K,V>expireAfterWrite(Duration expireAfterWrite)Sets cacheexpireAfterWrite.DurationgetExpireAfterAccess()DurationgetExpireAfterWrite()intgetInitialCapacity()longgetMaximumSize()longgetMaximumWeight()DurationgetRefreshAfterWrite()inthashCode()CaffeineCacheOptions<K,V>initialCapacity(int initialCapacity)Sets cacheinitialCapacity.booleanisSoftValues()booleanisWeakKeys()booleanisWeakValues()CaffeineCacheOptions<K,V>maximumSize(long maximumSize)Sets cachemaximumSize.CaffeineCacheOptions<K,V>maximumWeight(long maximumWeight)Sets cachemaximumWeight.CaffeineCacheOptions<K,V>refreshAfterWrite(Duration refreshAfterWrite)Sets cacherefreshAfterWrite.CaffeineCacheOptions<K,V>softValues(boolean softValues)Sets cachesoftValues.CaffeineCacheOptions<K,V>weakKeys(boolean weakKeys)Sets cacheweakKeys.CaffeineCacheOptions<K,V>weakValues(boolean weakValues)Sets cacheweakValues.-
Methods inherited from class cn.sliew.milky.cache.CacheOptions
defaults, getLoader, getName, getWriteBehindThreads, getWriteMode, getWriter, loader, name, writeBehindThreads, writeMode, writer
-
-
-
-
Method Detail
-
initialCapacity
public CaffeineCacheOptions<K,V> initialCapacity(int initialCapacity)
Sets cacheinitialCapacity.- Parameters:
initialCapacity- cache initialCapacity- Returns:
- CaffeineCacheOptions instance
-
getInitialCapacity
public int getInitialCapacity()
-
maximumSize
public CaffeineCacheOptions<K,V> maximumSize(long maximumSize)
Sets cachemaximumSize.- Parameters:
maximumSize- cache maximumSize- Returns:
- CaffeineCacheOptions instance
-
getMaximumSize
public long getMaximumSize()
-
maximumWeight
public CaffeineCacheOptions<K,V> maximumWeight(long maximumWeight)
Sets cachemaximumWeight.- Parameters:
maximumWeight- cache maximumWeight- Returns:
- CaffeineCacheOptions instance
-
getMaximumWeight
public long getMaximumWeight()
-
weakKeys
public CaffeineCacheOptions<K,V> weakKeys(boolean weakKeys)
Sets cacheweakKeys.- Parameters:
weakKeys- cache weak key.- Returns:
- CaffeineCacheOptions instance
-
isWeakKeys
public boolean isWeakKeys()
-
weakValues
public CaffeineCacheOptions<K,V> weakValues(boolean weakValues)
Sets cacheweakValues.- Parameters:
weakValues- cache weak value.- Returns:
- CaffeineCacheOptions instance
-
isWeakValues
public boolean isWeakValues()
-
softValues
public CaffeineCacheOptions<K,V> softValues(boolean softValues)
Sets cachesoftValues.- Parameters:
softValues- cache soft value.- Returns:
- CaffeineCacheOptions instance
-
isSoftValues
public boolean isSoftValues()
-
expireAfterAccess
public CaffeineCacheOptions<K,V> expireAfterAccess(Duration expireAfterAccess)
Sets cacheexpireAfterAccess.- Parameters:
expireAfterAccess- duration expire after cache access.- Returns:
- CaffeineCacheOptions instance
-
getExpireAfterAccess
public Duration getExpireAfterAccess()
-
expireAfterWrite
public CaffeineCacheOptions<K,V> expireAfterWrite(Duration expireAfterWrite)
Sets cacheexpireAfterWrite.- Parameters:
expireAfterWrite- duration expire after cache write.- Returns:
- CaffeineCacheOptions instance
-
getExpireAfterWrite
public Duration getExpireAfterWrite()
-
refreshAfterWrite
public CaffeineCacheOptions<K,V> refreshAfterWrite(Duration refreshAfterWrite)
Sets cacherefreshAfterWrite.- Parameters:
refreshAfterWrite- duration refresh after cache write.- Returns:
- CaffeineCacheOptions instance
-
getRefreshAfterWrite
public Duration getRefreshAfterWrite()
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classCacheOptions<K,V>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classCacheOptions<K,V>
-
-