|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ehcache.config.builders.CacheManagerBuilder<T>
public class CacheManagerBuilder<T extends CacheManager>
The CacheManagerBuilder
enables building cache managers 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 | ||
---|---|---|
T |
build()
Builds a CacheManager or a subtype of it uninitialized. |
|
T |
build(boolean init)
Builds a CacheManager or a subtype of it and initializes it if requested. |
|
static CacheManager |
newCacheManager(Configuration configuration)
Creates a new CacheManager based on the provided configuration |
|
static CacheManagerBuilder<CacheManager> |
newCacheManagerBuilder()
Creates a new CacheManagerBuilder |
|
static CacheManagerConfiguration<PersistentCacheManager> |
persistence(java.lang.String location)
Convenience method to get a CacheManagerConfiguration for a PersistentCacheManager . |
|
CacheManagerBuilder<T> |
replacing(ServiceCreationConfiguration<?> overwriteServiceConfiguration)
Replaces an existing ServiceCreationConfiguration of the same type on the returned builder. |
|
CacheManagerBuilder<T> |
using(Service service)
Adds a Service instance to the returned builder. |
|
CacheManagerBuilder<T> |
using(ServiceCreationConfiguration<?> serviceConfiguration)
Adds a ServiceCreationConfiguration to the returned builder. |
|
|
with(CacheManagerConfiguration<N> cfg)
Specifies the returned CacheManager subtype through a specific CacheManagerConfiguration which
will optionally add configurations to the returned builder. |
|
|
withCache(java.lang.String alias,
CacheConfiguration<K,V> configuration)
Adds a CacheConfiguration linked to the specified alias to the returned builder. |
|
|
withCache(java.lang.String alias,
CacheConfigurationBuilder<K,V> configurationBuilder)
Convenience method to add a CacheConfiguration linked to the specified alias to the returned builder by
building it from the provided CacheConfigurationBuilder . |
|
CacheManagerBuilder<T> |
withClassLoader(java.lang.ClassLoader classLoader)
Adds a ClassLoader , to use for non Ehcache types, to the returned builder |
|
|
withCopier(java.lang.Class<C> clazz,
java.lang.Class<? extends Copier<C>> copier)
Adds a default Copier for the specified type to the returned builder. |
|
CacheManagerBuilder<T> |
withDefaultDiskStoreThreadPool(java.lang.String threadPoolAlias)
Adds a OffHeapDiskStoreProviderConfiguration , that specifies the thread pool to use, to the returned
builder. |
|
CacheManagerBuilder<T> |
withDefaultEventListenersThreadPool(java.lang.String threadPoolAlias)
Adds a CacheEventDispatcherFactoryConfiguration , that specifies the thread pool to use, to the returned
builder. |
|
CacheManagerBuilder<T> |
withDefaultSizeOfMaxObjectGraph(long size)
Adds a default SizeOfEngine configuration, that limits the max object graph to
size, to the returned builder. |
|
CacheManagerBuilder<T> |
withDefaultSizeOfMaxObjectSize(long size,
MemoryUnit unit)
Adds a default SizeOfEngine configuration, that limits the max object size, to
the returned builder. |
|
CacheManagerBuilder<T> |
withDefaultWriteBehindThreadPool(java.lang.String threadPoolAlias)
Adds a WriteBehindProviderConfiguration , that specifies the thread pool to use, to the returned builder. |
|
|
withSerializer(java.lang.Class<C> clazz,
java.lang.Class<? extends Serializer<C>> serializer)
Adds a default Serializer for the specified type to the returned builder. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public T build(boolean init)
CacheManager
or a subtype of it and initializes it if requested.
init
- whether the returned CacheManager
is to be initialized or not
CacheManager
or a subtype of itpublic T build()
CacheManager
or a subtype of it uninitialized.
build
in interface Builder<T extends CacheManager>
CacheManager
or a subtype of it uninitializedpublic static CacheManager newCacheManager(Configuration configuration)
CacheManager
based on the provided configuration
configuration
- the configuration to use
CacheManager
public <K,V> CacheManagerBuilder<T> withCache(java.lang.String alias, CacheConfiguration<K,V> configuration)
CacheConfiguration
linked to the specified alias to the returned builder.
K
- the cache key typeV
- the cache value typealias
- the cache aliasconfiguration
- the CacheConfiguration
CacheConfigurationBuilder
public <K,V> CacheManagerBuilder<T> withCache(java.lang.String alias, CacheConfigurationBuilder<K,V> configurationBuilder)
CacheConfiguration
linked to the specified alias to the returned builder by
building it from the provided CacheConfigurationBuilder
.
K
- the cache key typeV
- the cache value typealias
- the cache aliasconfigurationBuilder
- the CacheConfigurationBuilder
to get CacheConfiguration
from
CacheConfigurationBuilder
public <N extends T> CacheManagerBuilder<N> with(CacheManagerConfiguration<N> cfg)
CacheManager
subtype through a specific CacheManagerConfiguration
which
will optionally add configurations to the returned builder.
N
- the subtype of CacheManager
cfg
- the CacheManagerConfiguration
to use
persistence(String)
,
PersistentCacheManager
,
CacheManagerPersistenceConfiguration
public CacheManagerBuilder<T> using(Service service)
Service
instance to the returned builder.
The service instance will be used by the constructed CacheManager
.
service
- the Service
to add
public <C> CacheManagerBuilder<T> withCopier(java.lang.Class<C> clazz, java.lang.Class<? extends Copier<C>> copier)
Copier
for the specified type to the returned builder.
C
- the type which can be copiedclazz
- the Class
for which the copier iscopier
- the Copier
instance
public <C> CacheManagerBuilder<T> withSerializer(java.lang.Class<C> clazz, java.lang.Class<? extends Serializer<C>> serializer)
Serializer
for the specified type to the returned builder.
C
- the type which can be serializedclazz
- the Class
for which the serializer isserializer
- the Serializer
instance
public CacheManagerBuilder<T> withDefaultSizeOfMaxObjectGraph(long size)
SizeOfEngine
configuration, that limits the max object graph to
size, to the returned builder.
size
- the max object graph size
public CacheManagerBuilder<T> withDefaultSizeOfMaxObjectSize(long size, MemoryUnit unit)
SizeOfEngine
configuration, that limits the max object size, to
the returned builder.
size
- the max object sizeunit
- the max object size unit
public CacheManagerBuilder<T> withDefaultWriteBehindThreadPool(java.lang.String threadPoolAlias)
WriteBehindProviderConfiguration
, that specifies the thread pool to use, to the returned builder.
threadPoolAlias
- the thread pool alias
PooledExecutionServiceConfigurationBuilder
public CacheManagerBuilder<T> withDefaultDiskStoreThreadPool(java.lang.String threadPoolAlias)
OffHeapDiskStoreProviderConfiguration
, that specifies the thread pool to use, to the returned
builder.
threadPoolAlias
- the thread pool alias
PooledExecutionServiceConfigurationBuilder
public CacheManagerBuilder<T> withDefaultEventListenersThreadPool(java.lang.String threadPoolAlias)
CacheEventDispatcherFactoryConfiguration
, that specifies the thread pool to use, to the returned
builder.
threadPoolAlias
- the thread pool alias
PooledExecutionServiceConfigurationBuilder
public CacheManagerBuilder<T> using(ServiceCreationConfiguration<?> serviceConfiguration)
ServiceCreationConfiguration
to the returned builder.
These configurations are used to load services and configure them at creation time.
serviceConfiguration
- the ServiceCreationConfiguration
to use
public CacheManagerBuilder<T> replacing(ServiceCreationConfiguration<?> overwriteServiceConfiguration)
ServiceCreationConfiguration
of the same type on the returned builder.
Duplicate service creation configuration will cause a cache manager to fail to initialize.
overwriteServiceConfiguration
- the new ServiceCreationConfiguration
to use
public CacheManagerBuilder<T> withClassLoader(java.lang.ClassLoader classLoader)
ClassLoader
, to use for non Ehcache types, to the returned builder
classLoader
- the class loader to use
public static CacheManagerBuilder<CacheManager> newCacheManagerBuilder()
CacheManagerBuilder
public static CacheManagerConfiguration<PersistentCacheManager> persistence(java.lang.String location)
CacheManagerConfiguration
for a PersistentCacheManager
.
location
- the file location for persistent data
CacheManagerConfiguration
with(CacheManagerConfiguration)
,
PersistentCacheManager
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |