Class Cache2kConfiguration<K,V>
- java.lang.Object
-
- org.cache2k.configuration.Cache2kConfiguration<K,V>
-
- All Implemented Interfaces:
Serializable
,ConfigurationBean
,ConfigurationWithSections
public class Cache2kConfiguration<K,V> extends Object implements ConfigurationBean, ConfigurationWithSections
Configuration for a cache2k cache.To create a cache, the
Cache2kBuilder
is used. All configuration properties are present on the builder and are documented in this place. Consequently all properties refer to the corresponding builder method.The configuration bean is designed to be serializable. This is used for example to copy default configurations. The builder allows object references to customizations to be set. If this happens the configuration is not serializable. Such configuration is only used for immediate creation of one cache via the builder.
The configuration may contain additional beans, called configuration sections, that are used to configure extensions or sub modules.
Within the XML configuration of a cache manager different default configuration values may be specified. To get a configuration bean with the effective defaults of a specific manager do
Cache2kBuilder.forUnknownTypes().manager(...).toConfiguration()
- Author:
- Jens Wilke
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static Duration
ETERNAL_DURATION
The maximum duration after the duration is considered as eternal for the purposes of caching.static Duration
EXPIRY_NOT_ETERNAL
Marker duration thatsetEternal(false)
was set.static long
UNSET_LONG
-
Constructor Summary
Constructors Constructor Description Cache2kConfiguration()
-
Method Summary
-
-
-
Field Detail
-
ETERNAL_DURATION
public static final Duration ETERNAL_DURATION
The maximum duration after the duration is considered as eternal for the purposes of caching.
-
EXPIRY_NOT_ETERNAL
public static final Duration EXPIRY_NOT_ETERNAL
Marker duration thatsetEternal(false)
was set.
-
UNSET_LONG
public static final long UNSET_LONG
- See Also:
- Constant Field Values
-
-
Method Detail
-
of
public static <K,V> Cache2kConfiguration<K,V> of(Class<K> keyType, Class<V> valueType)
Construct a config instance setting the type parameters and returning a proper generic type.
-
of
public static <K,V> Cache2kConfiguration<K,V> of(Class<K> keyType, CacheType<V> valueType)
Construct a config instance setting the type parameters and returning a proper generic type.
-
of
public static <K,V> Cache2kConfiguration<K,V> of(CacheType<K> keyType, Class<V> valueType)
Construct a config instance setting the type parameters and returning a proper generic type.
-
of
public static <K,V> Cache2kConfiguration<K,V> of(CacheType<K> keyType, CacheType<V> valueType)
Construct a config instance setting the type parameters and returning a proper generic type.
-
getName
public String getName()
- See Also:
Cache2kBuilder.name(String)
-
setName
public void setName(String name)
- See Also:
Cache2kBuilder.name(String)
-
getEntryCapacity
public long getEntryCapacity()
- See Also:
Cache2kBuilder.entryCapacity(long)
-
setEntryCapacity
public void setEntryCapacity(long v)
-
isRefreshAhead
public boolean isRefreshAhead()
- See Also:
Cache2kBuilder.refreshAhead(boolean)
-
setRefreshAhead
public void setRefreshAhead(boolean v)
- See Also:
Cache2kBuilder.refreshAhead(boolean)
-
isEternal
public boolean isEternal()
-
setEternal
public void setEternal(boolean v)
- See Also:
Cache2kBuilder.eternal(boolean)
-
getExpireAfterWrite
public Duration getExpireAfterWrite()
-
setExpireAfterWrite
public void setExpireAfterWrite(Duration v)
-
getTimerLag
public Duration getTimerLag()
-
setTimerLag
public void setTimerLag(Duration v)
- See Also:
Cache2kBuilder.timerLag(long, TimeUnit)
-
getRetryInterval
public Duration getRetryInterval()
-
setRetryInterval
public void setRetryInterval(Duration v)
-
getMaxRetryInterval
public Duration getMaxRetryInterval()
-
setMaxRetryInterval
public void setMaxRetryInterval(Duration v)
-
getResilienceDuration
public Duration getResilienceDuration()
-
setResilienceDuration
public void setResilienceDuration(Duration v)
-
isKeepDataAfterExpired
public boolean isKeepDataAfterExpired()
-
getMaximumWeight
public long getMaximumWeight()
-
setMaximumWeight
public void setMaximumWeight(long v)
- See Also:
Cache2kBuilder.maximumWeight(long)
-
setKeepDataAfterExpired
public void setKeepDataAfterExpired(boolean v)
-
isSharpExpiry
public boolean isSharpExpiry()
-
setSharpExpiry
public void setSharpExpiry(boolean v)
- See Also:
Cache2kBuilder.sharpExpiry(boolean)
-
isSuppressExceptions
public boolean isSuppressExceptions()
-
setSuppressExceptions
public void setSuppressExceptions(boolean v)
-
isExternalConfigurationPresent
public boolean isExternalConfigurationPresent()
An external configuration for the cache was found and is applied. This istrue
if default values are set via the XML configuration or if there is a specific section for the cache name.
-
setExternalConfigurationPresent
public void setExternalConfigurationPresent(boolean v)
-
getSections
public ConfigurationSectionContainer getSections()
Mutable collection of additional configuration sections- Specified by:
getSections
in interfaceConfigurationWithSections
-
setSections
public void setSections(Collection<ConfigurationSection> c)
Adds the collection of sections to the existing list. This method is intended to improve integration with bean configuration mechanisms that use the set method and construct a set or list, like Springs' bean XML configuration.
-
getLoader
public CustomizationSupplier<CacheLoader<K,V>> getLoader()
-
setLoader
public void setLoader(CustomizationSupplier<CacheLoader<K,V>> v)
-
getAdvancedLoader
public CustomizationSupplier<AdvancedCacheLoader<K,V>> getAdvancedLoader()
-
setAdvancedLoader
public void setAdvancedLoader(CustomizationSupplier<AdvancedCacheLoader<K,V>> v)
-
getAsyncLoader
public CustomizationSupplier<AsyncCacheLoader<K,V>> getAsyncLoader()
-
setAsyncLoader
public void setAsyncLoader(CustomizationSupplier<AsyncCacheLoader<K,V>> v)
-
getLoaderThreadCount
public int getLoaderThreadCount()
-
setLoaderThreadCount
public void setLoaderThreadCount(int v)
- See Also:
Cache2kBuilder.loaderThreadCount(int)
-
getExpiryPolicy
public CustomizationSupplier<ExpiryPolicy<K,V>> getExpiryPolicy()
-
setExpiryPolicy
public void setExpiryPolicy(CustomizationSupplier<ExpiryPolicy<K,V>> v)
-
getWriter
public CustomizationSupplier<CacheWriter<K,V>> getWriter()
-
setWriter
public void setWriter(CustomizationSupplier<CacheWriter<K,V>> v)
- See Also:
Cache2kBuilder.writer(CacheWriter)
-
isStoreByReference
public boolean isStoreByReference()
-
setStoreByReference
public void setStoreByReference(boolean v)
- See Also:
Cache2kBuilder.storeByReference(boolean)
-
getExceptionPropagator
public CustomizationSupplier<ExceptionPropagator<K>> getExceptionPropagator()
-
setExceptionPropagator
public void setExceptionPropagator(CustomizationSupplier<ExceptionPropagator<K>> v)
-
getListeners
public CustomizationCollection<CacheEntryOperationListener<K,V>> getListeners()
A set of listeners. Listeners added in this collection will be executed in a synchronous mode, meaning, further processing for an entry will stall until a registered listener is executed. The expiry will be always executed asynchronously.A listener can be added by adding it to the collection. Duplicate (in terms of equal objects) listeners will be ignored.
- Returns:
- Mutable collection of listeners
-
hasListeners
public boolean hasListeners()
- Returns:
- True if listeners are added to this configuration.
-
setListeners
public void setListeners(Collection<CustomizationSupplier<CacheEntryOperationListener<K,V>>> c)
Adds the collection of customizations to the existing list. This method is intended to improve integration with bean configuration mechanisms that use the set method and construct a set or list, like Springs' bean XML configuration.
-
getAsyncListeners
public CustomizationCollection<CacheEntryOperationListener<K,V>> getAsyncListeners()
A set of listeners. A listener can be added by adding it to the collection. Duplicate (in terms of equal objects) listeners will be ignored.- Returns:
- Mutable collection of listeners
-
hasAsyncListeners
public boolean hasAsyncListeners()
- Returns:
- True if listeners are added to this configuration.
-
setAsyncListeners
public void setAsyncListeners(Collection<CustomizationSupplier<CacheEntryOperationListener<K,V>>> c)
Adds the collection of customizations to the existing list. This method is intended to improve integration with bean configuration mechanisms that use the set method and construct a set or list, like Springs' bean XML configuration.
-
getCacheClosedListeners
public CustomizationCollection<CacheClosedListener> getCacheClosedListeners()
A set of listeners. A listener can be added by adding it to the collection. Duplicate (in terms of equal objects) listeners will be ignored.- Returns:
- Mutable collection of listeners
- Since:
- 1.0.2
-
hasCacheClosedListeners
public boolean hasCacheClosedListeners()
- Returns:
- True if listeners are added to this configuration.
-
setCacheClosedListeners
public void setCacheClosedListeners(Collection<CustomizationSupplier<CacheClosedListener>> c)
Adds the collection of customizations to the existing list. This method is intended to improve integration with bean configuration mechanisms that use the set method and construct a set or list, like Springs' bean XML configuration.
-
getResiliencePolicy
public CustomizationSupplier<ResiliencePolicy<K,V>> getResiliencePolicy()
-
setResiliencePolicy
public void setResiliencePolicy(CustomizationSupplier<ResiliencePolicy<K,V>> v)
-
isStrictEviction
public boolean isStrictEviction()
-
setStrictEviction
public void setStrictEviction(boolean v)
- See Also:
Cache2kBuilder.strictEviction(boolean)
-
isPermitNullValues
public boolean isPermitNullValues()
-
setPermitNullValues
public void setPermitNullValues(boolean v)
- See Also:
Cache2kBuilder.permitNullValues(boolean)
-
isDisableStatistics
public boolean isDisableStatistics()
-
setDisableStatistics
public void setDisableStatistics(boolean v)
-
getLoaderExecutor
public CustomizationSupplier<Executor> getLoaderExecutor()
-
isRecordRefreshedTime
public boolean isRecordRefreshedTime()
-
setRecordRefreshedTime
public void setRecordRefreshedTime(boolean v)
-
setLoaderExecutor
public void setLoaderExecutor(CustomizationSupplier<Executor> v)
- See Also:
Cache2kBuilder.loaderExecutor(Executor)
-
getRefreshExecutor
public CustomizationSupplier<Executor> getRefreshExecutor()
-
setRefreshExecutor
public void setRefreshExecutor(CustomizationSupplier<Executor> v)
- See Also:
Cache2kBuilder.refreshExecutor(Executor)
-
getExecutor
public CustomizationSupplier<Executor> getExecutor()
-
setExecutor
public void setExecutor(CustomizationSupplier<Executor> v)
- See Also:
Cache2kBuilder.executor(Executor)
-
getAsyncListenerExecutor
public CustomizationSupplier<Executor> getAsyncListenerExecutor()
-
setAsyncListenerExecutor
public void setAsyncListenerExecutor(CustomizationSupplier<Executor> v)
-
getTimeReference
public CustomizationSupplier<TimeReference> getTimeReference()
-
setTimeReference
public void setTimeReference(CustomizationSupplier<TimeReference> v)
-
getWeigher
public CustomizationSupplier<Weigher> getWeigher()
-
setWeigher
public void setWeigher(CustomizationSupplier<Weigher> v)
- See Also:
Cache2kBuilder.weigher(Weigher)
-
isBoostConcurrency
public boolean isBoostConcurrency()
-
setBoostConcurrency
public void setBoostConcurrency(boolean v)
- See Also:
Cache2kBuilder.boostConcurrency(boolean)
-
isEnableJmx
public boolean isEnableJmx()
-
setEnableJmx
public void setEnableJmx(boolean v)
- See Also:
Cache2kBuilder.enableJmx(boolean)
-
isDisableMonitoring
public boolean isDisableMonitoring()
-
setDisableMonitoring
public void setDisableMonitoring(boolean disableMonitoring)
-
-