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(javax.cache.configuration.CacheEntryListenerConfiguration<K, V>).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(javax.cache.configuration.CacheEntryListenerConfiguration<K, V>).voidsetCacheLoaderFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheLoader<K, V>> factory) SeeMutableConfiguration.setCacheLoaderFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheLoader<K, V>>).voidsetCacheWriterFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheWriter<? super K, ? super V>> factory) SeeMutableConfiguration.setCacheWriterFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheWriter<? super K, ? super V>>).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(javax.cache.configuration.Factory<? extends javax.cache.expiry.ExpiryPolicy>).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(java.lang.Class<K>, java.lang.Class<V>).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
SeeMutableConfiguration.setTypes(java.lang.Class<K>, java.lang.Class<V>). -
getCacheEntryListenerConfigurations
-
addCacheEntryListenerConfiguration
public void addCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration) SeeMutableConfiguration.addCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K, V>). -
removeCacheEntryListenerConfiguration
public void removeCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration) SeeMutableConfiguration.removeCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K, V>). -
getCacheLoaderFactory
-
setCacheLoaderFactory
public void setCacheLoaderFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheLoader<K, V>> factory) SeeMutableConfiguration.setCacheLoaderFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheLoader<K, V>>). -
getCacheWriterFactory
-
getCacheWriter
- Returns:
- a writer created by the configured factory or null if not set.
-
hasCacheWriter
public boolean hasCacheWriter()- Returns:
- if the cache writer factory is specified.
-
setCacheWriterFactory
public void setCacheWriterFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheWriter<? super K, ? super V>> factory) SeeMutableConfiguration.setCacheWriterFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheWriter<? super K, ? super V>>). -
getExpiryPolicyFactory
public javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy> getExpiryPolicyFactory() -
setExpiryPolicyFactory
public void setExpiryPolicyFactory(javax.cache.configuration.Factory<? extends javax.cache.expiry.ExpiryPolicy> factory) SeeMutableConfiguration.setExpiryPolicyFactory(javax.cache.configuration.Factory<? extends javax.cache.expiry.ExpiryPolicy>). -
isReadThrough
public boolean isReadThrough() -
setReadThrough
public void setReadThrough(boolean isReadThrough) SeeMutableConfiguration.setReadThrough(boolean). -
isWriteThrough
public boolean isWriteThrough() -
setWriteThrough
public void setWriteThrough(boolean isWriteThrough) SeeMutableConfiguration.setWriteThrough(boolean). -
isStoreByValue
public 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
public boolean isStatisticsEnabled() -
setStatisticsEnabled
public void setStatisticsEnabled(boolean enabled) SeeMutableConfiguration.setStatisticsEnabled(boolean). -
isManagementEnabled
public boolean isManagementEnabled()SeeMutableConfiguration.isManagementEnabled. -
setManagementEnabled
public void setManagementEnabled(boolean enabled) SeeMutableConfiguration.setManagementEnabled(boolean). -
getCopierFactory
Returns theFactoryfor theCopierto be used for the cache.- Returns:
- the
Factoryfor theCopier
-
setCopierFactory
Set theFactoryfor theCopier.- Parameters:
factory- theCopierFactory
-
getSchedulerFactory
Returns theFactoryfor theSchedulerto be used for the cache.- Returns:
- the
Factoryfor theScheduler
-
setSchedulerFactory
Set theFactoryfor theScheduler.- Parameters:
factory- theSchedulerFactory
-
getTickerFactory
Returns theFactoryfor theTickerto be used for the cache.- Returns:
- the
Factoryfor theTicker
-
setTickerFactory
Set theFactoryfor theTicker.- Parameters:
factory- theTickerFactory
-
getExecutorFactory
Returns theFactoryfor theExecutorto be used for the cache.- Returns:
- the
Factoryfor theExecutor
-
setExecutorFactory
Set theFactoryfor theExecutor.- Parameters:
factory- theExecutorFactory
-
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
Returns theFactoryfor theExpiryto be used for the cache.- Returns:
- the
Factoryfor theExpiry
-
setExpiryFactory
public void setExpiryFactory(Optional<javax.cache.configuration.Factory<? extends Expiry<K, V>>> factory) Set theFactoryfor theExpiry.- Parameters:
factory- theExpiryFactory
-
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
Returns theFactoryfor theWeigherto be used for the cache.- Returns:
- the
Factoryfor theWeigher
-
setWeigherFactory
public void setWeigherFactory(Optional<javax.cache.configuration.Factory<? extends Weigher<K, V>>> factory) Set theFactoryfor theWeigher.- Parameters:
factory- theWeigherFactory
-
equals
-
hashCode
public int hashCode()
-