public class CacheConfigurationBuilder<K,V> extends java.lang.Object implements org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>
CacheConfigurationBuilder enables building CacheConfigurations using a fluent style.
As with all Ehcache builders, all instances are immutable and calling any method on the builder will return a new instance without modifying the one on which the method was called. This enables the sharing of builder instances without any risk of seeing them modified by code elsewhere.
| Modifier and Type | Method and Description |
|---|---|
CacheConfigurationBuilder<K,V> |
add(org.ehcache.config.Builder<? extends org.ehcache.spi.service.ServiceConfiguration<?,?>> configurationBuilder)
Deprecated.
in favor of
FluentCacheConfigurationBuilder.withService(Builder) |
CacheConfigurationBuilder<K,V> |
add(org.ehcache.spi.service.ServiceConfiguration<?,?> configuration)
Deprecated.
in favor of
withService(ServiceConfiguration) |
org.ehcache.config.CacheConfiguration<K,V> |
build() |
CacheConfigurationBuilder<K,V> |
clearAllServiceConfig()
Deprecated.
in favor of
withoutServices(ServiceConfiguration.class) |
<T extends org.ehcache.spi.service.ServiceConfiguration<?,?>> |
getExistingServiceConfiguration(java.lang.Class<T> clazz)
Deprecated.
in favor of
FluentCacheConfigurationBuilder.getService(Class) |
<T extends org.ehcache.spi.service.ServiceConfiguration<?,?>> |
getExistingServiceConfigurations(java.lang.Class<T> clazz)
Deprecated.
in favor of
getServices(Class) |
<C extends org.ehcache.spi.service.ServiceConfiguration<?,?>> |
getServices(java.lang.Class<C> configurationType) |
boolean |
hasConfiguredExpiry()
Indicates whether this builder has configured expiry or not.
|
static <K,V> CacheConfigurationBuilder<K,V> |
newCacheConfigurationBuilder(org.ehcache.config.CacheConfiguration<K,V> configuration)
Creates a new instance ready to produce a
CacheConfiguration functionally equivalent to the supplied configuration. |
static <K,V> CacheConfigurationBuilder<K,V> |
newCacheConfigurationBuilder(java.lang.Class<K> keyType,
java.lang.Class<V> valueType,
org.ehcache.config.Builder<? extends org.ehcache.config.ResourcePools> resourcePoolsBuilder)
Creates a new instance ready to produce a
CacheConfiguration with key type <K> and with value type
<V> and which will use the configured resources, passed as a ResourcePoolsBuilder. |
static <K,V> CacheConfigurationBuilder<K,V> |
newCacheConfigurationBuilder(java.lang.Class<K> keyType,
java.lang.Class<V> valueType,
org.ehcache.config.ResourcePools resourcePools)
Creates a new instance ready to produce a
CacheConfiguration with key type <K> and with value type
<V> and which will use the configured resources. |
CacheConfigurationBuilder<K,V> |
remove(org.ehcache.spi.service.ServiceConfiguration<?,?> configuration)
Deprecated.
in favor of
withoutServices(Class) or withoutServices(Class, Predicate) |
CacheConfigurationBuilder<K,V> |
updateResourcePools(java.util.function.UnaryOperator<org.ehcache.config.ResourcePools> update) |
<R,C extends org.ehcache.spi.service.ServiceConfiguration<?,R>> |
updateServices(java.lang.Class<C> clazz,
java.util.function.UnaryOperator<R> update) |
CacheConfigurationBuilder<K,V> |
withClassLoader(java.lang.ClassLoader classLoader) |
CacheConfigurationBuilder<K,V> |
withDefaultClassLoader() |
CacheConfigurationBuilder<K,V> |
withDefaultDiskStoreThreadPool()
Restores the default disk store thread pool settings.
|
CacheConfigurationBuilder<K,V> |
withDefaultDispatcherConcurrency()
Restores the default dispatcher concurrency.
|
CacheConfigurationBuilder<K,V> |
withDefaultEventListenersThreadPool()
Restores the default event listener thread pool settings.
|
CacheConfigurationBuilder<K,V> |
withDefaultKeySerializer() |
CacheConfigurationBuilder<K,V> |
withDefaultResilienceStrategy() |
CacheConfigurationBuilder<K,V> |
withDefaultSizeOfSettings()
Deprecated.
|
CacheConfigurationBuilder<K,V> |
withDefaultValueSerializer() |
CacheConfigurationBuilder<K,V> |
withDiskStoreThreadPool(java.lang.String threadPoolAlias,
int concurrency)
Adds a
ServiceConfiguration for the OffHeapDiskStore.Provider
indicating thread pool alias and write concurrency. |
CacheConfigurationBuilder<K,V> |
withDispatcherConcurrency(int dispatcherConcurrency)
Adds
StoreEventSourceConfiguration with the specified dispatcher concurrency
to the configured builder. |
CacheConfigurationBuilder<K,V> |
withEventListenersThreadPool(java.lang.String threadPoolAlias)
Adds a
ServiceConfiguration for the CacheEventDispatcherFactory specifying
the thread pool alias to use. |
CacheConfigurationBuilder<K,V> |
withEvictionAdvisor(org.ehcache.config.EvictionAdvisor<? super K,? super V> evictionAdvisor) |
CacheConfigurationBuilder<K,V> |
withExpiry(org.ehcache.expiry.Expiry<? super K,? super V> expiry)
Deprecated.
Use
withExpiry(ExpiryPolicy) instead |
CacheConfigurationBuilder<K,V> |
withExpiry(org.ehcache.expiry.ExpiryPolicy<? super K,? super V> expiry) |
CacheConfigurationBuilder<K,V> |
withKeyCopier(java.lang.Class<? extends org.ehcache.spi.copy.Copier<K>> keyCopierClass) |
CacheConfigurationBuilder<K,V> |
withKeyCopier(org.ehcache.spi.copy.Copier<K> keyCopier) |
CacheConfigurationBuilder<K,V> |
withKeySerializer(java.lang.Class<? extends org.ehcache.spi.serialization.Serializer<K>> keySerializerClass) |
CacheConfigurationBuilder<K,V> |
withKeySerializer(org.ehcache.spi.serialization.Serializer<K> keySerializer) |
CacheConfigurationBuilder<K,V> |
withKeySerializingCopier() |
CacheConfigurationBuilder<K,V> |
withLoaderWriter(org.ehcache.spi.loaderwriter.CacheLoaderWriter<K,V> loaderWriter) |
CacheConfigurationBuilder<K,V> |
withLoaderWriter(java.lang.Class<org.ehcache.spi.loaderwriter.CacheLoaderWriter<K,V>> loaderWriterClass,
java.lang.Object... arguments) |
CacheConfigurationBuilder<K,V> |
withoutKeyCopier() |
CacheConfigurationBuilder<K,V> |
withoutLoaderWriter() |
CacheConfigurationBuilder<K,V> |
withoutServices(java.lang.Class<? extends org.ehcache.spi.service.ServiceConfiguration<?,?>> clazz) |
<C extends org.ehcache.spi.service.ServiceConfiguration<?,?>> |
withoutServices(java.lang.Class<C> clazz,
java.util.function.Predicate<? super C> predicate) |
CacheConfigurationBuilder<K,V> |
withoutValueCopier() |
CacheConfigurationBuilder<K,V> |
withResilienceStrategy(java.lang.Class<? extends org.ehcache.spi.resilience.ResilienceStrategy> resilienceStrategyClass,
java.lang.Object... arguments) |
CacheConfigurationBuilder<K,V> |
withResilienceStrategy(org.ehcache.spi.resilience.ResilienceStrategy<K,V> resilienceStrategy) |
CacheConfigurationBuilder<K,V> |
withResourcePools(org.ehcache.config.ResourcePools resourcePools) |
CacheConfigurationBuilder<K,V> |
withService(org.ehcache.spi.service.ServiceConfiguration<?,?> config) |
CacheConfigurationBuilder<K,V> |
withSizeOfMaxObjectGraph(long size)
Deprecated.
|
CacheConfigurationBuilder<K,V> |
withSizeOfMaxObjectSize(long size,
org.ehcache.config.units.MemoryUnit unit)
Deprecated.
|
CacheConfigurationBuilder<K,V> |
withValueCopier(java.lang.Class<? extends org.ehcache.spi.copy.Copier<V>> valueCopierClass) |
CacheConfigurationBuilder<K,V> |
withValueCopier(org.ehcache.spi.copy.Copier<V> valueCopier) |
CacheConfigurationBuilder<K,V> |
withValueSerializer(java.lang.Class<? extends org.ehcache.spi.serialization.Serializer<V>> valueSerializerClass) |
CacheConfigurationBuilder<K,V> |
withValueSerializer(org.ehcache.spi.serialization.Serializer<V> valueSerializer) |
CacheConfigurationBuilder<K,V> |
withValueSerializingCopier() |
public static <K,V> CacheConfigurationBuilder<K,V> newCacheConfigurationBuilder(java.lang.Class<K> keyType, java.lang.Class<V> valueType, org.ehcache.config.ResourcePools resourcePools)
CacheConfiguration with key type <K> and with value type
<V> and which will use the configured resources.K - the key typeV - the value typekeyType - the key typevalueType - the value typeresourcePools - the resources to useCacheConfigurationBuilderpublic static <K,V> CacheConfigurationBuilder<K,V> newCacheConfigurationBuilder(java.lang.Class<K> keyType, java.lang.Class<V> valueType, org.ehcache.config.Builder<? extends org.ehcache.config.ResourcePools> resourcePoolsBuilder)
CacheConfiguration with key type <K> and with value type
<V> and which will use the configured resources, passed as a ResourcePoolsBuilder.K - the key typeV - the value typekeyType - the key typevalueType - the value typeresourcePoolsBuilder - the resources to use, as a builderCacheConfigurationBuilderpublic static <K,V> CacheConfigurationBuilder<K,V> newCacheConfigurationBuilder(org.ehcache.config.CacheConfiguration<K,V> configuration)
CacheConfiguration functionally equivalent to the supplied configuration.K - the key typeV - the value typeconfiguration - seed configurationCacheConfigurationBuilder@Deprecated public CacheConfigurationBuilder<K,V> add(org.ehcache.spi.service.ServiceConfiguration<?,?> configuration)
withService(ServiceConfiguration)ServiceConfiguration to the returned builder.configuration - the service configuration to add@Deprecated public CacheConfigurationBuilder<K,V> add(org.ehcache.config.Builder<? extends org.ehcache.spi.service.ServiceConfiguration<?,?>> configurationBuilder)
FluentCacheConfigurationBuilder.withService(Builder)ServiceConfiguration that is produced by a Builder.configurationBuilder - the service configuration to add, Builder.build() will be called on itadd(ServiceConfiguration)public <C extends org.ehcache.spi.service.ServiceConfiguration<?,?>> java.util.Collection<C> getServices(java.lang.Class<C> configurationType)
throws java.lang.IllegalArgumentException
getServices in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>java.lang.IllegalArgumentExceptionpublic CacheConfigurationBuilder<K,V> withService(org.ehcache.spi.service.ServiceConfiguration<?,?> config)
withService in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withoutServices(java.lang.Class<? extends org.ehcache.spi.service.ServiceConfiguration<?,?>> clazz)
withoutServices in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public <C extends org.ehcache.spi.service.ServiceConfiguration<?,?>> CacheConfigurationBuilder<K,V> withoutServices(java.lang.Class<C> clazz, java.util.function.Predicate<? super C> predicate)
withoutServices in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public <R,C extends org.ehcache.spi.service.ServiceConfiguration<?,R>> CacheConfigurationBuilder<K,V> updateServices(java.lang.Class<C> clazz, java.util.function.UnaryOperator<R> update)
updateServices in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withEvictionAdvisor(org.ehcache.config.EvictionAdvisor<? super K,? super V> evictionAdvisor)
withEvictionAdvisor in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>@Deprecated public CacheConfigurationBuilder<K,V> remove(org.ehcache.spi.service.ServiceConfiguration<?,?> configuration)
withoutServices(Class) or withoutServices(Class, Predicate)ServiceConfiguration from the returned builder.configuration - the service configuration to remove@Deprecated public CacheConfigurationBuilder<K,V> clearAllServiceConfig()
withoutServices(ServiceConfiguration.class)ServiceConfigurations from the returned builder.@Deprecated public <T extends org.ehcache.spi.service.ServiceConfiguration<?,?>> T getExistingServiceConfiguration(java.lang.Class<T> clazz)
FluentCacheConfigurationBuilder.getService(Class)ServiceConfiguration with type matching the class passed in.T - the type of the service configurationclazz - the service configuration classnull if none can be found@Deprecated public <T extends org.ehcache.spi.service.ServiceConfiguration<?,?>> java.util.List<T> getExistingServiceConfigurations(java.lang.Class<T> clazz)
getServices(Class)ServiceConfigurations of type matching the class passed in.T - the type of the service configurationclazz - the service configuration classpublic CacheConfigurationBuilder<K,V> withClassLoader(java.lang.ClassLoader classLoader)
withClassLoader in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withDefaultClassLoader()
withDefaultClassLoader in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withResourcePools(org.ehcache.config.ResourcePools resourcePools)
withResourcePools in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> updateResourcePools(java.util.function.UnaryOperator<org.ehcache.config.ResourcePools> update)
updateResourcePools in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>@Deprecated public CacheConfigurationBuilder<K,V> withExpiry(org.ehcache.expiry.Expiry<? super K,? super V> expiry)
withExpiry(ExpiryPolicy) insteadExpiry configuration to the returned builder.
Expiry is what controls data freshness in a cache.
expiry - the expiry to usepublic CacheConfigurationBuilder<K,V> withExpiry(org.ehcache.expiry.ExpiryPolicy<? super K,? super V> expiry)
withExpiry in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public boolean hasConfiguredExpiry()
true if expiry configured, false otherwisepublic CacheConfigurationBuilder<K,V> withLoaderWriter(org.ehcache.spi.loaderwriter.CacheLoaderWriter<K,V> loaderWriter)
withLoaderWriter in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withLoaderWriter(java.lang.Class<org.ehcache.spi.loaderwriter.CacheLoaderWriter<K,V>> loaderWriterClass, java.lang.Object... arguments)
withLoaderWriter in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withoutLoaderWriter()
withoutLoaderWriter in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withResilienceStrategy(org.ehcache.spi.resilience.ResilienceStrategy<K,V> resilienceStrategy)
withResilienceStrategy in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withResilienceStrategy(java.lang.Class<? extends org.ehcache.spi.resilience.ResilienceStrategy> resilienceStrategyClass, java.lang.Object... arguments)
withResilienceStrategy in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withDefaultResilienceStrategy()
withDefaultResilienceStrategy in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withKeySerializingCopier()
withKeySerializingCopier in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withValueSerializingCopier()
withValueSerializingCopier in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withKeyCopier(org.ehcache.spi.copy.Copier<K> keyCopier)
withKeyCopier in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withKeyCopier(java.lang.Class<? extends org.ehcache.spi.copy.Copier<K>> keyCopierClass)
withKeyCopier in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withoutKeyCopier()
withoutKeyCopier in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withValueCopier(org.ehcache.spi.copy.Copier<V> valueCopier)
withValueCopier in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withValueCopier(java.lang.Class<? extends org.ehcache.spi.copy.Copier<V>> valueCopierClass)
withValueCopier in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withoutValueCopier()
withoutValueCopier in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withKeySerializer(org.ehcache.spi.serialization.Serializer<K> keySerializer)
withKeySerializer in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withKeySerializer(java.lang.Class<? extends org.ehcache.spi.serialization.Serializer<K>> keySerializerClass)
withKeySerializer in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withDefaultKeySerializer()
withDefaultKeySerializer in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withValueSerializer(org.ehcache.spi.serialization.Serializer<V> valueSerializer)
withValueSerializer in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withValueSerializer(java.lang.Class<? extends org.ehcache.spi.serialization.Serializer<V>> valueSerializerClass)
withValueSerializer in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withDefaultValueSerializer()
withDefaultValueSerializer in interface org.ehcache.config.FluentCacheConfigurationBuilder<K,V,CacheConfigurationBuilder<K,V>>public CacheConfigurationBuilder<K,V> withDispatcherConcurrency(int dispatcherConcurrency)
StoreEventSourceConfiguration with the specified dispatcher concurrency
to the configured builder.dispatcherConcurrency - the level of concurrency in the dispatcher for ordered eventswithDefaultDispatcherConcurrency()public CacheConfigurationBuilder<K,V> withDefaultDispatcherConcurrency()
withDispatcherConcurrency(int)public CacheConfigurationBuilder<K,V> withEventListenersThreadPool(java.lang.String threadPoolAlias)
ServiceConfiguration for the CacheEventDispatcherFactory specifying
the thread pool alias to use.threadPoolAlias - the thread pool alias to usewithDefaultEventListenersThreadPool()public CacheConfigurationBuilder<K,V> withDefaultEventListenersThreadPool()
withEventListenersThreadPool(String)public CacheConfigurationBuilder<K,V> withDiskStoreThreadPool(java.lang.String threadPoolAlias, int concurrency)
ServiceConfiguration for the OffHeapDiskStore.Provider
indicating thread pool alias and write concurrency.threadPoolAlias - the thread pool aliasconcurrency - the write concurrencywithDefaultDiskStoreThreadPool()public CacheConfigurationBuilder<K,V> withDefaultDiskStoreThreadPool()
withDiskStoreThreadPool(String, int)@Deprecated public CacheConfigurationBuilder<K,V> withSizeOfMaxObjectGraph(long size)
org.ehcache.impl.config.store.heap.DefaultSizeOfEngineConfiguration with the specified object graph maximum size to the configured
builder.
org.ehcache.core.spi.store.heap.SizeOfEngine is what enables the heap tier to be sized in MemoryUnit.
size - the maximum graph sizewithSizeOfMaxObjectSize(long, MemoryUnit),
withDefaultSizeOfSettings()@Deprecated public CacheConfigurationBuilder<K,V> withSizeOfMaxObjectSize(long size, org.ehcache.config.units.MemoryUnit unit)
org.ehcache.impl.config.store.heap.DefaultSizeOfEngineConfiguration with the specified maximum mapping size to the configured
builder.
org.ehcache.core.spi.store.heap.SizeOfEngine is what enables the heap tier to be sized in MemoryUnit.
size - the maximum mapping sizeunit - the memory unitwithSizeOfMaxObjectGraph(long),
withDefaultSizeOfSettings()@Deprecated public CacheConfigurationBuilder<K,V> withDefaultSizeOfSettings()
withSizeOfMaxObjectGraph(long),
withSizeOfMaxObjectSize(long, MemoryUnit)