|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ehcache.config.builders.UserManagedCacheBuilder<K,V,T>
K
- the cache key typeV
- the cache value typeT
- the specific UserManagedCache
typepublic class UserManagedCacheBuilder<K,V,T extends UserManagedCache<K,V>>
The UserManagedCacheBuilder
enables building UserManagedCache
s using a fluent style.
UserManagedCache
s are Cache
s that are not linked to a CacheManager
.
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 an unitialized UserManagedCache . |
|
T |
build(boolean init)
Builds the UserManagedCache , initializing it if requested. |
|
UserManagedCacheBuilder<K,V,T> |
identifier(java.lang.String identifier)
Adds an identifier to the returned builder. |
|
static
|
newUserManagedCacheBuilder(java.lang.Class<K> keyType,
java.lang.Class<V> valueType)
Creates a new UserManagedCacheBuilder . |
|
UserManagedCacheBuilder<K,V,T> |
using(Service service)
Adds a Service to be made available to the returned builder. |
|
UserManagedCacheBuilder<K,V,T> |
using(ServiceCreationConfiguration<?> serviceConfiguration)
Adds a ServiceCreationConfiguration , to trigger a service loading and its configuration, to the returned
builder. |
|
|
with(UserManagedCacheConfiguration<K,V,N> cfg)
Specifies the returned UserManagedCache subtype through a specific UserManagedCacheConfiguration
which will optionally add configurations to the returned builder. |
|
UserManagedCacheBuilder<K,V,T> |
withClassLoader(java.lang.ClassLoader classLoader)
Adds a ClassLoader , to load non Ehcache types, to the returned builder. |
|
UserManagedCacheBuilder<K,V,T> |
withEventDispatcher(CacheEventDispatcher<K,V> eventDispatcher)
Adds an CacheEventDispatcher to the returned builder. |
|
UserManagedCacheBuilder<K,V,T> |
withEventExecutors(java.util.concurrent.ExecutorService orderedExecutor,
java.util.concurrent.ExecutorService unOrderedExecutor)
Adds the default CacheEventDispatcher using the provided ExecutorService to the returned builder. |
|
UserManagedCacheBuilder<K,V,T> |
withEventListeners(CacheEventListenerConfiguration... cacheEventListenerConfigurations)
Adds one or more CacheEventListenerConfiguration to the returned builder. |
|
UserManagedCacheBuilder<K,V,T> |
withEventListeners(CacheEventListenerConfigurationBuilder cacheEventListenerConfiguration)
Convenience method to add a CacheEventListenerConfiguration based on the provided
CacheEventListenerConfigurationBuilder to the returned builder. |
|
UserManagedCacheBuilder<K,V,T> |
withEvictionVeto(EvictionVeto<K,V> evictionVeto)
Adds an EvictionVeto to the returned builder. |
|
UserManagedCacheBuilder<K,V,T> |
withExpiry(Expiry<K,V> expiry)
Adds Expiry configuration to the returned builder. |
|
UserManagedCacheBuilder<K,V,T> |
withKeyCopier(Copier<K> keyCopier)
Adds a configuration for key Copier to the returned builder. |
|
UserManagedCacheBuilder<K,V,T> |
withKeySerializer(Serializer<K> keySerializer)
Adds a configuration for key Serializer to the returned builder. |
|
UserManagedCacheBuilder<K,V,T> |
withKeySerializingCopier()
Adds a configuration for key copying using the key Serializer to the returned builder. |
|
UserManagedCacheBuilder<K,V,T> |
withLoaderWriter(CacheLoaderWriter<K,V> loaderWriter)
Adds a CacheLoaderWriter to the returned builder. |
|
UserManagedCacheBuilder<K,V,T> |
withOrderedEventParallelism(int parallelism)
Adds a configuration for the amount of ordered parallelism desired in event processing. |
|
UserManagedCacheBuilder<K,V,T> |
withResourcePools(ResourcePools resourcePools)
Adds a ResourcePools configuration to the returned builder. |
|
UserManagedCacheBuilder<K,V,T> |
withResourcePools(ResourcePoolsBuilder resourcePoolsBuilder)
Convenience method to add a ResourcePools configuration based on the provided ResourcePoolsBuilder
to the returned builder. |
|
UserManagedCacheBuilder<K,V,T> |
withSizeOfMaxObjectGraph(long size)
Adds or updates the DefaultSizeOfEngineProviderConfiguration with the specified object graph maximum size to the configured
builder. |
|
UserManagedCacheBuilder<K,V,T> |
withSizeOfMaxObjectSize(long size,
MemoryUnit unit)
Adds or updates the DefaultSizeOfEngineProviderConfiguration with the specified maximum mapping size to the configured
builder. |
|
UserManagedCacheBuilder<K,V,T> |
withValueCopier(Copier<V> valueCopier)
Adds a configuration for value Copier to the returned builder. |
|
UserManagedCacheBuilder<K,V,T> |
withValueSerializer(Serializer<V> valueSerializer)
Adds a configuration for value Serializer to the returned builder. |
|
UserManagedCacheBuilder<K,V,T> |
withValueSerializingCopier()
Adds a configuration for value copying using the key Serializer 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 final T build(boolean init) throws java.lang.IllegalStateException
UserManagedCache
, initializing it if requested.
init
- whether to initialize or not the cache before returning
java.lang.IllegalStateException
- if the user managed cache cannot be builtpublic T build()
UserManagedCache
.
build
in interface Builder<T extends UserManagedCache<K,V>>
public final <N extends T> UserManagedCacheBuilder<K,V,N> with(UserManagedCacheConfiguration<K,V,N> cfg)
UserManagedCache
subtype through a specific UserManagedCacheConfiguration
which will optionally add configurations to the returned builder.
N
- the subtype of UserManagedCache
cfg
- the UserManagedCacheConfiguration
to use
PersistentUserManagedCache
,
UserManagedPersistenceContext
public final UserManagedCacheBuilder<K,V,T> identifier(java.lang.String identifier)
The identifier will be used in services and logging the way a cache alias would be inside a CacheManager
identifier
- the identifier
public final UserManagedCacheBuilder<K,V,T> withClassLoader(java.lang.ClassLoader classLoader)
ClassLoader
, to load non Ehcache types, to the returned builder.
classLoader
- the class loader to use
public final UserManagedCacheBuilder<K,V,T> withExpiry(Expiry<K,V> expiry)
Expiry
configuration to the returned builder.
expiry
- the expiry to use
public final UserManagedCacheBuilder<K,V,T> withEventDispatcher(CacheEventDispatcher<K,V> eventDispatcher)
CacheEventDispatcher
to the returned builder.
This is one way of providing a mandatory part of supporting event listeners in UserManagedCache
eventDispatcher
- the event dispatcher to use
withEventExecutors(ExecutorService, ExecutorService)
,
withEventListeners(CacheEventListenerConfiguration...)
,
withEventListeners(CacheEventListenerConfigurationBuilder)
public final UserManagedCacheBuilder<K,V,T> withEventExecutors(java.util.concurrent.ExecutorService orderedExecutor, java.util.concurrent.ExecutorService unOrderedExecutor)
CacheEventDispatcher
using the provided ExecutorService
to the returned builder.
This is one way of providing a mandatory part of supporting event listeners in UserManagedCache
orderedExecutor
- the ordered event executor serviceunOrderedExecutor
- the unordered event executor service
withEventDispatcher(CacheEventDispatcher)
,
withEventListeners(CacheEventListenerConfiguration...)
,
withEventListeners(CacheEventListenerConfigurationBuilder)
public final UserManagedCacheBuilder<K,V,T> withEventListeners(CacheEventListenerConfigurationBuilder cacheEventListenerConfiguration)
CacheEventListenerConfiguration
based on the provided
CacheEventListenerConfigurationBuilder
to the returned builder.
cacheEventListenerConfiguration
- the builder to get the configuration from
withEventDispatcher(CacheEventDispatcher)
,
withEventExecutors(ExecutorService, ExecutorService)
,
withEventListeners(CacheEventListenerConfiguration...)
public final UserManagedCacheBuilder<K,V,T> withEventListeners(CacheEventListenerConfiguration... cacheEventListenerConfigurations)
CacheEventListenerConfiguration
to the returned builder.
cacheEventListenerConfigurations
- the cache event listener configurations
withEventDispatcher(CacheEventDispatcher)
,
withEventExecutors(ExecutorService, ExecutorService)
,
withEventListeners(CacheEventListenerConfigurationBuilder)
public final UserManagedCacheBuilder<K,V,T> withResourcePools(ResourcePools resourcePools)
ResourcePools
configuration to the returned builder.
resourcePools
- the resource pools to use
withResourcePools(ResourcePoolsBuilder)
public final UserManagedCacheBuilder<K,V,T> withResourcePools(ResourcePoolsBuilder resourcePoolsBuilder)
ResourcePools
configuration based on the provided ResourcePoolsBuilder
to the returned builder.
resourcePoolsBuilder
- the builder to get the resource pools from
withResourcePools(ResourcePools)
public final UserManagedCacheBuilder<K,V,T> withOrderedEventParallelism(int parallelism)
parallelism
- the parallelism level
public UserManagedCacheBuilder<K,V,T> withEvictionVeto(EvictionVeto<K,V> evictionVeto)
EvictionVeto
to the returned builder.
evictionVeto
- the eviction veto to use
public UserManagedCacheBuilder<K,V,T> withLoaderWriter(CacheLoaderWriter<K,V> loaderWriter)
CacheLoaderWriter
to the returned builder.
loaderWriter
- the cache loader writer to use
public UserManagedCacheBuilder<K,V,T> withKeySerializingCopier()
key copying
using the key Serializer
to the returned builder.
withKeyCopier(Copier)
,
withKeySerializer(Serializer)
public UserManagedCacheBuilder<K,V,T> withValueSerializingCopier()
value copying
using the key Serializer
to the returned builder.
withValueCopier(Copier)
,
withValueSerializer(Serializer)
public UserManagedCacheBuilder<K,V,T> withKeyCopier(Copier<K> keyCopier)
Copier
to the returned builder.
keyCopier
- the key copier to use
withKeySerializingCopier()
public UserManagedCacheBuilder<K,V,T> withValueCopier(Copier<V> valueCopier)
Copier
to the returned builder.
valueCopier
- the value copier to use
withValueSerializingCopier()
public UserManagedCacheBuilder<K,V,T> withKeySerializer(Serializer<K> keySerializer)
Serializer
to the returned builder.
keySerializer
- the key serializer to use
public UserManagedCacheBuilder<K,V,T> withValueSerializer(Serializer<V> valueSerializer)
Serializer
to the returned builder.
valueSerializer
- the value serializer to use
public UserManagedCacheBuilder<K,V,T> withSizeOfMaxObjectGraph(long size)
DefaultSizeOfEngineProviderConfiguration
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 UserManagedCacheBuilder<K,V,T> withSizeOfMaxObjectSize(long size, MemoryUnit unit)
DefaultSizeOfEngineProviderConfiguration
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 static <K,V> UserManagedCacheBuilder<K,V,UserManagedCache<K,V>> newUserManagedCacheBuilder(java.lang.Class<K> keyType, java.lang.Class<V> valueType)
UserManagedCacheBuilder
.
K
- the key typeV
- the value typekeyType
- the cache key typevalueType
- the cache value type
public UserManagedCacheBuilder<K,V,T> using(Service service)
Service
to be made available to the returned builder.
Note that while Service
s will be started upon UserManagedCache
construction, no other lifecycle
operations will be performed on them. It is the responsibility of the developer to properly stop
Service
s once they are no longer required.
service
- the service to add
using(ServiceCreationConfiguration)
public UserManagedCacheBuilder<K,V,T> using(ServiceCreationConfiguration<?> serviceConfiguration)
ServiceCreationConfiguration
, to trigger a service loading and its configuration, to the returned
builder.
Note that while Service
s will be started upon UserManagedCache
construction, no other lifecycle
operations will be performed on them. It is the responsibility of the developer to properly stop
Service
s once they are no longer required. Which means that this method should not be used to get
services that require a stop.
serviceConfiguration
- the service creation configuration to add
using(Service)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |