|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ehcache.config.builders.CacheConfigurationBuilder<K,V>
public class CacheConfigurationBuilder<K,V>
The CacheConfigurationBuilder
enables building CacheConfiguration
s 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.
Method Summary | ||
---|---|---|
CacheConfigurationBuilder<K,V> |
add(Builder<? extends ServiceConfiguration<?>> configurationBuilder)
Convenience method to add a ServiceConfiguration that is produced by a Builder . |
|
CacheConfigurationBuilder<K,V> |
add(ServiceConfiguration<?> configuration)
Adds a ServiceConfiguration to the returned builder. |
|
CacheConfiguration<K,V> |
build()
Builds the instance |
|
CacheConfigurationBuilder<K,V> |
clearAllServiceConfig()
Clears all ServiceConfiguration s from the returned builder. |
|
|
getExistingServiceConfiguration(java.lang.Class<T> clazz)
Returns the first ServiceConfiguration with type matching the class passed in. |
|
|
getExistingServiceConfigurations(java.lang.Class<T> clazz)
Returns all ServiceConfiguration s of type matching the class passed in. |
|
boolean |
hasConfiguredExpiry()
Indicates whether this builder has configured expiry or not. |
|
static
|
newCacheConfigurationBuilder(java.lang.Class<K> keyType,
java.lang.Class<V> valueType)
Creates a new instance ready to produce a CacheConfiguration with key type <K> and with value type
<V> . |
|
CacheConfigurationBuilder<K,V> |
remove(ServiceConfiguration<?> configuration)
Removes a ServiceConfiguration from the returned builder. |
|
CacheConfigurationBuilder<K,V> |
withClassLoader(java.lang.ClassLoader classLoader)
Adds a ClassLoader to the returned builder. |
|
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> |
withEventListenersThreadPool(java.lang.String threadPoolAlias)
Adds a ServiceConfiguration for the CacheEventDispatcherFactory specifying
the thread pool alias to use. |
|
CacheConfigurationBuilder<K,V> |
withEvictionVeto(EvictionVeto<? super K,? super V> veto)
Adds an EvictionVeto to the returned builder. |
|
CacheConfigurationBuilder<K,V> |
withExpiry(Expiry<? super K,? super V> expiry)
Adds Expiry configuration to the returned builder. |
|
CacheConfigurationBuilder<K,V> |
withKeyCopier(java.lang.Class<? extends Copier<K>> keyCopierClass)
Adds by-value semantic using the provided Copier class for the key on heap. |
|
CacheConfigurationBuilder<K,V> |
withKeyCopier(Copier<K> keyCopier)
Adds by-value semantic using the provided Copier for the key on heap. |
|
CacheConfigurationBuilder<K,V> |
withKeySerializer(java.lang.Class<? extends Serializer<K>> keySerializerClass)
Adds a Serializer class for cache keys to the configured builder. |
|
CacheConfigurationBuilder<K,V> |
withKeySerializer(Serializer<K> keySerializer)
Adds a Serializer for cache keys to the configured builder. |
|
CacheConfigurationBuilder<K,V> |
withKeySerializingCopier()
Adds by-value semantic using the cache key serializer for the key on heap. |
|
CacheConfigurationBuilder<K,V> |
withLoaderWriter(CacheLoaderWriter<K,V> loaderWriter)
Adds a CacheLoaderWriter to the configured builder. |
|
CacheConfigurationBuilder<K,V> |
withLoaderWriter(java.lang.Class<CacheLoaderWriter<K,V>> loaderWriterClass,
java.lang.Object... arguments)
Adds a CacheLoaderWriter configured through a class and optional constructor arguments to the configured
builder. |
|
CacheConfigurationBuilder<K,V> |
withOrderedEventParallelism(int eventParallelism)
Adds StoreEventSourceConfiguration with the specified ordered event parallelism
to the configured builder. |
|
CacheConfigurationBuilder<K,V> |
withResourcePools(ResourcePools resourcePools)
Adds the ResourcePools to the returned builder. |
|
CacheConfigurationBuilder<K,V> |
withResourcePools(ResourcePoolsBuilder resourcePoolsBuilder)
Convenience method to add a ResourcePools through a ResourcePoolsBuilder to the returned builder. |
|
CacheConfigurationBuilder<K,V> |
withSizeOfMaxObjectGraph(long size)
Adds or updates the DefaultSizeOfEngineConfiguration with the specified object graph maximum size to the configured
builder. |
|
CacheConfigurationBuilder<K,V> |
withSizeOfMaxObjectSize(long size,
MemoryUnit unit)
Adds or updates the DefaultSizeOfEngineConfiguration with the specified maximum mapping size to the configured
builder. |
|
CacheConfigurationBuilder<K,V> |
withValueCopier(java.lang.Class<? extends Copier<V>> valueCopierClass)
Adds by-value semantic using the provided Copier class for the value on heap. |
|
CacheConfigurationBuilder<K,V> |
withValueCopier(Copier<V> valueCopier)
Adds by-value semantic using the provided Copier for the value on heap. |
|
CacheConfigurationBuilder<K,V> |
withValueSerializer(java.lang.Class<? extends Serializer<V>> valueSerializerClass)
Adds a Serializer class for cache values to the configured builder. |
|
CacheConfigurationBuilder<K,V> |
withValueSerializer(Serializer<V> valueSerializer)
Adds a Serializer for cache values to the configured builder. |
|
CacheConfigurationBuilder<K,V> |
withValueSerializingCopier()
Adds by-value semantic using the cache value serializer for the value on heap. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <K,V> CacheConfigurationBuilder<K,V> newCacheConfigurationBuilder(java.lang.Class<K> keyType, java.lang.Class<V> valueType)
CacheConfiguration
with key type <K>
and with value type
<V>
.
K
- the key typeV
- the value typekeyType
- the key typevalueType
- the value type
CacheConfigurationBuilder
public CacheConfigurationBuilder<K,V> add(ServiceConfiguration<?> configuration)
ServiceConfiguration
to the returned builder.
configuration
- the service configuration to add
public CacheConfigurationBuilder<K,V> add(Builder<? extends ServiceConfiguration<?>> configurationBuilder)
ServiceConfiguration
that is produced by a Builder
.
configurationBuilder
- the service configuration to add, Builder.build()
will be called on it
add(ServiceConfiguration)
public CacheConfigurationBuilder<K,V> withEvictionVeto(EvictionVeto<? super K,? super V> veto)
EvictionVeto
to the returned builder.
veto
- the eviction veto to be used
public CacheConfigurationBuilder<K,V> remove(ServiceConfiguration<?> configuration)
ServiceConfiguration
from the returned builder.
configuration
- the service configuration to remove
public CacheConfigurationBuilder<K,V> clearAllServiceConfig()
ServiceConfiguration
s from the returned builder.
public <T extends ServiceConfiguration<?>> T getExistingServiceConfiguration(java.lang.Class<T> clazz)
ServiceConfiguration
with type matching the class passed in.
T
- the type of the service configurationclazz
- the service configuration class
null
if none can be foundpublic <T extends ServiceConfiguration<?>> java.util.List<T> getExistingServiceConfigurations(java.lang.Class<T> clazz)
ServiceConfiguration
s of type matching the class passed in.
T
- the type of the service configurationclazz
- the service configuration class
public CacheConfigurationBuilder<K,V> withClassLoader(java.lang.ClassLoader classLoader)
ClassLoader
to the returned builder.
The ClassLoader
will be used for resolving all non Ehcache types.
classLoader
- the class loader to use
public CacheConfigurationBuilder<K,V> withResourcePools(ResourcePools resourcePools)
ResourcePools
to the returned builder.
ResourcePools
is what determines the tiering of a cache.
resourcePools
- the resource pools to use
public CacheConfigurationBuilder<K,V> withResourcePools(ResourcePoolsBuilder resourcePoolsBuilder)
ResourcePools
through a ResourcePoolsBuilder
to the returned builder.
resourcePoolsBuilder
- the builder providing the resource pool
withResourcePools(ResourcePools)
public CacheConfigurationBuilder<K,V> withExpiry(Expiry<? super K,? super V> expiry)
Expiry
configuration to the returned builder.
Expiry
is what controls data freshness in a cache.
expiry
- the expiry to use
public boolean hasConfiguredExpiry()
true
if expiry configured, false
otherwisepublic CacheConfigurationBuilder<K,V> withLoaderWriter(CacheLoaderWriter<K,V> loaderWriter)
CacheLoaderWriter
to the configured builder.
Configuration of a CacheLoaderWriter
is what enables cache-through patterns.
loaderWriter
- the loaderwriter to use
public CacheConfigurationBuilder<K,V> withLoaderWriter(java.lang.Class<CacheLoaderWriter<K,V>> loaderWriterClass, java.lang.Object... arguments)
CacheLoaderWriter
configured through a class and optional constructor arguments to the configured
builder.
Configuration of a CacheLoaderWriter
is what enables cache-through patterns.
loaderWriterClass
- the loaderwrite classarguments
- optional constructor arguments
public CacheConfigurationBuilder<K,V> withKeySerializingCopier()
Copier
s are what enable control of by-reference / by-value semantics for on-heap tier.
public CacheConfigurationBuilder<K,V> withValueSerializingCopier()
Copier
s are what enable control of by-reference / by-value semantics for on-heap tier.
public CacheConfigurationBuilder<K,V> withKeyCopier(Copier<K> keyCopier)
Copier
for the key on heap.
Copier
s are what enable control of by-reference / by-value semantics for on-heap tier.
keyCopier
- the key copier to use
public CacheConfigurationBuilder<K,V> withKeyCopier(java.lang.Class<? extends Copier<K>> keyCopierClass)
Copier
class for the key on heap.
Copier
s are what enable control of by-reference / by-value semantics for on-heap tier.
keyCopierClass
- the key copier class to use
public CacheConfigurationBuilder<K,V> withValueCopier(Copier<V> valueCopier)
Copier
for the value on heap.
Copier
s are what enable control of by-reference / by-value semantics for on-heap tier.
valueCopier
- the value copier to use
public CacheConfigurationBuilder<K,V> withValueCopier(java.lang.Class<? extends Copier<V>> valueCopierClass)
Copier
class for the value on heap.
Copier
s are what enable control of by-reference / by-value semantics for on-heap tier.
valueCopierClass
- the value copier class to use
public CacheConfigurationBuilder<K,V> withKeySerializer(Serializer<K> keySerializer)
Serializer
for cache keys to the configured builder.
Serializer
s are what enables cache storage beyond the heap tier.
keySerializer
- the key serializer to use
public CacheConfigurationBuilder<K,V> withKeySerializer(java.lang.Class<? extends Serializer<K>> keySerializerClass)
Serializer
class for cache keys to the configured builder.
Serializer
s are what enables cache storage beyond the heap tier.
keySerializerClass
- the key serializer to use
public CacheConfigurationBuilder<K,V> withValueSerializer(Serializer<V> valueSerializer)
Serializer
for cache values to the configured builder.
Serializer
s are what enables cache storage beyond the heap tier.
valueSerializer
- the key serializer to use
public CacheConfigurationBuilder<K,V> withValueSerializer(java.lang.Class<? extends Serializer<V>> valueSerializerClass)
Serializer
class for cache values to the configured builder.
Serializer
s are what enables cache storage beyond the heap tier.
valueSerializerClass
- the key serializer to use
public CacheConfigurationBuilder<K,V> withOrderedEventParallelism(int eventParallelism)
StoreEventSourceConfiguration
with the specified ordered event parallelism
to the configured builder.
eventParallelism
- the amount of parallelism for handling events when ordering is required
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 use
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 concurrency
public CacheConfigurationBuilder<K,V> withSizeOfMaxObjectGraph(long size)
DefaultSizeOfEngineConfiguration
with the specified object graph maximum size to the configured
builder.
SizeOfEngine
is what enables the heap tier to be sized in MemoryUnit
.
size
- the maximum graph size
public CacheConfigurationBuilder<K,V> withSizeOfMaxObjectSize(long size, MemoryUnit unit)
DefaultSizeOfEngineConfiguration
with the specified maximum mapping size to the configured
builder.
SizeOfEngine
is what enables the heap tier to be sized in MemoryUnit
.
size
- the maximum mapping sizeunit
- the memory unit
public CacheConfiguration<K,V> build()
Builder
build
in interface Builder<CacheConfiguration<K,V>>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |