Class CaffeineConfiguration<K,V>
java.lang.Object
com.github.benmanes.caffeine.jcache.configuration.CaffeineConfiguration<K,V>
- All Implemented Interfaces:
Serializable, javax.cache.configuration.CompleteConfiguration<K,V>, javax.cache.configuration.Configuration<K, V>
public final class CaffeineConfiguration<K,V>
extends Object
implements javax.cache.configuration.CompleteConfiguration<K,V>
A JCache configuration with Caffeine specific settings.
The initial settings disable store by value so that entries are not copied when crossing
the Cache API boundary. If enabled and the Copier is not explicitly
set, then the JavaSerializationCopier will be used. This differs from
MutableConfiguration which enables store by value at construction.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final javax.cache.configuration.Factory<Executor> private javax.cache.configuration.Factory<Copier> private static final javax.cache.configuration.Factory<Scheduler> private javax.cache.configuration.Factory<Executor> private @Nullable Longprivate @Nullable Longprivate static final javax.cache.configuration.Factory<Copier> private @Nullable Longprivate @Nullable Longprivate booleanprivate @Nullable Longprivate javax.cache.configuration.Factory<Scheduler> private static final longprivate static final javax.cache.configuration.Factory<Ticker> private javax.cache.configuration.Factory<Ticker> -
Constructor Summary
ConstructorsConstructorDescriptionCaffeineConfiguration(javax.cache.configuration.CompleteConfiguration<K, V> configuration) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration) SeeMutableConfiguration.addCacheEntryListenerConfiguration(CacheEntryListenerConfiguration).booleanjavax.cache.configuration.Factory<Copier> Returns theFactoryfor theCopierto be used for the cache.javax.cache.configuration.Factory<Executor> Returns theFactoryfor theExecutorto be used for the cache.Returns the expire after access in nanoseconds.Returns the expire after write in nanoseconds.Returns theFactoryfor theExpiryto be used for the cache.javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy> Returns the maximum size to be used for the cache.Returns the maximum weight to be used for the cache.Returns the refresh after write in nanoseconds.javax.cache.configuration.Factory<Scheduler> Returns theFactoryfor theSchedulerto be used for the cache.javax.cache.configuration.Factory<Ticker> Returns theFactoryfor theTickerto be used for the cache.Returns theFactoryfor theWeigherto be used for the cache.booleaninthashCode()booleanSeeMutableConfiguration.isManagementEnabled.booleanChecks whether native statistics collection is enabled in this cache.booleanbooleanbooleanbooleanvoidremoveCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration) SeeMutableConfiguration.removeCacheEntryListenerConfiguration(CacheEntryListenerConfiguration).voidsetCacheLoaderFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheLoader<K, V>> factory) SeeMutableConfiguration.setCacheLoaderFactory(Factory).voidsetCacheWriterFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheWriter<? super K, ? super V>> factory) SeeMutableConfiguration.setCacheWriterFactory(Factory).voidsetCopierFactory(javax.cache.configuration.Factory<Copier> factory) Set theFactoryfor theCopier.voidsetExecutorFactory(javax.cache.configuration.Factory<Executor> factory) Set theFactoryfor theExecutor.voidsetExpireAfterAccess(OptionalLong expireAfterAccessNanos) Set the expire after write in nanoseconds.voidsetExpireAfterWrite(OptionalLong expireAfterWriteNanos) Set the expire after write in nanoseconds.voidsetExpiryFactory(Optional<javax.cache.configuration.Factory<? extends Expiry<K, V>>> factory) Set theFactoryfor theExpiry.voidsetExpiryPolicyFactory(javax.cache.configuration.Factory<? extends javax.cache.expiry.ExpiryPolicy> factory) SeeMutableConfiguration.setExpiryPolicyFactory(Factory).voidsetManagementEnabled(boolean enabled) SeeMutableConfiguration.setManagementEnabled(boolean).voidsetMaximumSize(OptionalLong maximumSize) Set the maximum size.voidsetMaximumWeight(OptionalLong maximumWeight) Set the maximum weight.voidsetNativeStatisticsEnabled(boolean enabled) Sets whether native statistics gathering is enabled on a cache.voidsetReadThrough(boolean isReadThrough) SeeMutableConfiguration.setReadThrough(boolean).voidsetRefreshAfterWrite(OptionalLong refreshAfterWriteNanos) Set the refresh after write in nanoseconds.voidsetSchedulerFactory(javax.cache.configuration.Factory<Scheduler> factory) Set theFactoryfor theScheduler.voidsetStatisticsEnabled(boolean enabled) SeeMutableConfiguration.setStatisticsEnabled(boolean).voidsetStoreByValue(boolean isStoreByValue) SeeMutableConfiguration.setStoreByValue(boolean).voidsetTickerFactory(javax.cache.configuration.Factory<Ticker> factory) Set theFactoryfor theTicker.voidSeeMutableConfiguration.setTypes(Class, Class).voidsetWeigherFactory(Optional<javax.cache.configuration.Factory<? extends Weigher<K, V>>> factory) Set theFactoryfor theWeigher.voidsetWriteThrough(boolean isWriteThrough) SeeMutableConfiguration.setWriteThrough(boolean).
-
Field Details
-
DISABLED_SCHEDULER
-
JAVA_COPIER
-
COMMON_POOL
-
SYSTEM_TICKER
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
delegate
-
weigherFactory
-
expiryFactory
-
schedulerFactory
-
executorFactory
-
copierFactory
-
tickerFactory
-
refreshAfterWriteNanos
-
expireAfterAccessNanos
-
expireAfterWriteNanos
-
maximumWeight
-
maximumSize
-
nativeStatistics
private boolean nativeStatistics
-
-
Constructor Details
-
CaffeineConfiguration
public CaffeineConfiguration() -
CaffeineConfiguration
-
-
Method Details
-
getKeyType
-
getValueType
-
setTypes
-
getCacheEntryListenerConfigurations
-
addCacheEntryListenerConfiguration
-
removeCacheEntryListenerConfiguration
-
getCacheLoaderFactory
-
setCacheLoaderFactory
-
getCacheWriterFactory
-
getCacheWriter
-
hasCacheWriter
public boolean hasCacheWriter()- Returns:
- if the cache writer factory is specified.
-
setCacheWriterFactory
-
getExpiryPolicyFactory
-
setExpiryPolicyFactory
public void setExpiryPolicyFactory(javax.cache.configuration.Factory<? extends javax.cache.expiry.ExpiryPolicy> factory) SeeMutableConfiguration.setExpiryPolicyFactory(Factory). -
isReadThrough
-
setReadThrough
public void setReadThrough(boolean isReadThrough) SeeMutableConfiguration.setReadThrough(boolean). -
isWriteThrough
-
setWriteThrough
public void setWriteThrough(boolean isWriteThrough) SeeMutableConfiguration.setWriteThrough(boolean). -
isStoreByValue
-
setStoreByValue
public void setStoreByValue(boolean isStoreByValue) SeeMutableConfiguration.setStoreByValue(boolean). -
isNativeStatisticsEnabled
public boolean isNativeStatisticsEnabled()Checks whether native statistics collection is enabled in this cache.The default value is
false.- Returns:
- true if native statistics collection is enabled
-
setNativeStatisticsEnabled
public void setNativeStatisticsEnabled(boolean enabled) Sets whether native statistics gathering is enabled on a cache.- Parameters:
enabled- true to enable native statistics, false to disable.
-
isStatisticsEnabled
-
setStatisticsEnabled
public void setStatisticsEnabled(boolean enabled) SeeMutableConfiguration.setStatisticsEnabled(boolean). -
isManagementEnabled
-
setManagementEnabled
public void setManagementEnabled(boolean enabled) SeeMutableConfiguration.setManagementEnabled(boolean). -
getCopierFactory
-
setCopierFactory
-
getSchedulerFactory
-
setSchedulerFactory
-
getTickerFactory
-
setTickerFactory
-
getExecutorFactory
-
setExecutorFactory
-
getRefreshAfterWrite
Returns the refresh after write in nanoseconds.- Returns:
- the duration in nanoseconds
-
setRefreshAfterWrite
Set the refresh after write in nanoseconds.- Parameters:
refreshAfterWriteNanos- the duration in nanoseconds
-
getExpireAfterWrite
Returns the expire after write in nanoseconds.- Returns:
- the duration in nanoseconds
-
setExpireAfterWrite
Set the expire after write in nanoseconds.- Parameters:
expireAfterWriteNanos- the duration in nanoseconds
-
getExpireAfterAccess
Returns the expire after access in nanoseconds.- Returns:
- the duration in nanoseconds
-
setExpireAfterAccess
Set the expire after write in nanoseconds.- Parameters:
expireAfterAccessNanos- the duration in nanoseconds
-
getExpiryFactory
-
setExpiryFactory
-
setMaximumSize
Set the maximum size.- Parameters:
maximumSize- the maximum size
-
getMaximumSize
Returns the maximum size to be used for the cache.- Returns:
- the maximum size
-
setMaximumWeight
Set the maximum weight.- Parameters:
maximumWeight- the maximum weighted size
-
getMaximumWeight
Returns the maximum weight to be used for the cache.- Returns:
- the maximum weight
-
getWeigherFactory
-
setWeigherFactory
-
equals
-
hashCode
-