public class ResourcePoolsBuilder extends java.lang.Object implements Builder<ResourcePools>
ResourcePoolsBuilder enables building ResourcePools configurations 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 |
|---|---|
ResourcePools |
build()
Builds the
ResourcePools based on this builder's configuration. |
ResourcePoolsBuilder |
disk(long size,
MemoryUnit unit)
Convenience method to add a non persistent
disk pool. |
ResourcePoolsBuilder |
disk(long size,
MemoryUnit unit,
boolean persistent)
Convenience method to add a
disk pool specifying persistence. |
static ResourcePoolsBuilder |
heap(long entries)
|
ResourcePoolsBuilder |
heap(long size,
ResourceUnit unit)
Convenience method to add a
heap pool. |
static ResourcePoolsBuilder |
newResourcePoolsBuilder()
Creates a new
ResourcePoolsBuilder. |
static ResourcePoolsBuilder |
newResourcePoolsBuilder(ResourcePools pools)
Convenience method to get a builder from an existing
ResourcePools. |
ResourcePoolsBuilder |
offheap(long size,
MemoryUnit unit)
Convenience method to add an
offheap pool. |
ResourcePoolsBuilder |
shared(ResourceType<?> type) |
ResourcePoolsBuilder |
shared(ResourceType<?> type,
boolean persistent) |
ResourcePoolsBuilder |
sharedDisk()
Informs the cache manager that an existing
disk shared pool,
defined on the cache manager, should be used for the cache's disk caching requirements. |
ResourcePoolsBuilder |
sharedHeap()
Informs the cache manager that an existing
heap shared pool,
defined on the cache manager, should be used for the cache's on-heap caching requirements. |
ResourcePoolsBuilder |
sharedOffheap()
Informs the cache manager that an existing
offheap shared pool,
defined on the cache manager, should be used for the cache's offheap caching requirements. |
ResourcePoolsBuilder |
with(ResourcePool resourcePool)
Add the
ResourcePool of ResourceType in the returned builder. |
ResourcePoolsBuilder |
with(ResourceType<SizedResourcePool> type,
long size,
ResourceUnit unit,
boolean persistent)
Add the
ResourcePool of ResourceType in the returned builder. |
ResourcePoolsBuilder |
withReplacing(ResourcePool resourcePool)
Add or replace the
ResourcePool of ResourceType in the returned builder. |
public static ResourcePoolsBuilder newResourcePoolsBuilder()
ResourcePoolsBuilder.public static ResourcePoolsBuilder newResourcePoolsBuilder(ResourcePools pools)
ResourcePools.pools - the resource pools to build frompublic static ResourcePoolsBuilder heap(long entries)
entries - the maximum number of mappings to cachepublic ResourcePoolsBuilder with(ResourcePool resourcePool)
ResourcePool of ResourceType in the returned builder.resourcePool - the non-null resource pool to addjava.lang.IllegalArgumentException - if the set of resource pools already contains a pool for typepublic ResourcePoolsBuilder withReplacing(ResourcePool resourcePool)
ResourcePool of ResourceType in the returned builder.resourcePool - the non-null resource pool to add/replacepublic ResourcePoolsBuilder with(ResourceType<SizedResourcePool> type, long size, ResourceUnit unit, boolean persistent)
ResourcePool of ResourceType in the returned builder.type - the resource typesize - the pool sizeunit - the pool size unitpersistent - if the pool is to be persistentjava.lang.IllegalArgumentException - if the set of resource pools already contains a pool for typepublic ResourcePoolsBuilder heap(long size, ResourceUnit unit)
heap pool.size - the pool sizeunit - the pool size unitjava.lang.IllegalArgumentException - if the set of resource pools already contains a heap resourcepublic ResourcePoolsBuilder sharedHeap()
heap shared pool,
defined on the cache manager, should be used for the cache's on-heap caching requirements.public ResourcePoolsBuilder offheap(long size, MemoryUnit unit)
offheap pool.size - the pool sizeunit - the pool size unitjava.lang.IllegalArgumentException - if the set of resource pools already contains an offheap resourcepublic ResourcePoolsBuilder sharedOffheap()
offheap shared pool,
defined on the cache manager, should be used for the cache's offheap caching requirements.public ResourcePoolsBuilder disk(long size, MemoryUnit unit)
disk pool.size - the pool sizeunit - the pool size unitjava.lang.IllegalArgumentException - if the set of resource pools already contains a disk resourcepublic ResourcePoolsBuilder disk(long size, MemoryUnit unit, boolean persistent)
disk pool specifying persistence.size - the pool sizeunit - the pool size unitpersistent - if the pool is persistent or notjava.lang.IllegalArgumentException - if the set of resource pools already contains a disk resourcepublic ResourcePoolsBuilder sharedDisk()
disk shared pool,
defined on the cache manager, should be used for the cache's disk caching requirements.public ResourcePoolsBuilder shared(ResourceType<?> type, boolean persistent)
public ResourcePoolsBuilder shared(ResourceType<?> type)
public ResourcePools build()
ResourcePools based on this builder's configuration.build in interface Builder<ResourcePools>