ehcache

net.sf.ehcache.config
Class CacheConfiguration

java.lang.Object
  extended by net.sf.ehcache.config.CacheConfiguration
All Implemented Interfaces:
Cloneable

public class CacheConfiguration
extends Object
implements Cloneable

A value object used to represent cache configuration.

Construction Patterns

The recommended way of creating a Cache in Ehcache 2.0 and above is to create a CacheConfiguration object and pass it to the Cache constructor. See Cache.Cache(CacheConfiguration).

This class supports setter injection and also the fluent builder pattern. e.g. Cache cache = new Cache(new CacheConfiguration("test2", 1000).eternal(true).memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.FIFO));

Rather than proliferation of new constructors as new versions of Ehcache come out, it intended to add the new configuration to this class.

Another way to set configuration is declaratively in the ehcache.xml configuration file. e.g.

<cache name="testCache1"
   maxElementsInMemory="10000"
   eternal="false"
   timeToIdleSeconds="3600"
   timeToLiveSeconds="10"
   overflowToDisk="true"
   diskPersistent="true"
   diskExpiryThreadIntervalSeconds="120"
   maxElementsOnDisk="10000"
 />
 

Dynamic Configuration

CacheConfiguration instances retrieved from Cache instances allow the dynamic modification of certain configuration properties. Currently the dynamic properties are: Dynamic changes are however not persistent across cache restarts. On restart the cache configuration will be reloaded from its original source, erasing any changes made previously at runtime.

Version:
$Id: CacheConfiguration.java 3711 2011-02-26 03:59:13Z gkeim $
Author:
Greg Luck, Chris Dennis

Nested Class Summary
static class CacheConfiguration.BootstrapCacheLoaderFactoryConfiguration
          Configuration for the BootstrapCacheLoaderFactoryConfiguration.
static class CacheConfiguration.CacheDecoratorFactoryConfiguration
          Configuration for the CacheDecoratorFactoryConfiguration.
static class CacheConfiguration.CacheEventListenerFactoryConfiguration
          Configuration for the CachePeerListenerFactoryConfiguration.
static class CacheConfiguration.CacheExceptionHandlerFactoryConfiguration
          Configuration for the BootstrapCacheLoaderFactoryConfiguration.
static class CacheConfiguration.CacheExtensionFactoryConfiguration
          Configuration for the CacheExtensionFactoryConfiguration.
static class CacheConfiguration.CacheLoaderFactoryConfiguration
          Configuration for the CacheLoaderFactoryConfiguration.
static class CacheConfiguration.TransactionalMode
          Represents whether the Cache is transactional or not.
 
Field Summary
protected  CacheConfiguration.BootstrapCacheLoaderFactoryConfiguration bootstrapCacheLoaderFactoryConfiguration
          The BootstrapCacheLoaderFactoryConfiguration.
protected  List<CacheConfiguration.CacheDecoratorFactoryConfiguration> cacheDecoratorConfigurations
          The cache decorator factories added by BeanUtils.
protected  List<CacheConfiguration.CacheEventListenerFactoryConfiguration> cacheEventListenerConfigurations
          The event listener factories added by BeanUtils.
protected  CacheConfiguration.CacheExceptionHandlerFactoryConfiguration cacheExceptionHandlerFactoryConfiguration
          The CacheExceptionHandlerFactoryConfiguration.
protected  List<CacheConfiguration.CacheExtensionFactoryConfiguration> cacheExtensionConfigurations
          The cache extension factories added by BeanUtils.
protected  List<CacheConfiguration.CacheLoaderFactoryConfiguration> cacheLoaderConfigurations
          The cache loader factories added by BeanUtils.
protected  long cacheLoaderTimeoutMillis
          Timeout in milliseconds for CacheLoader related calls
protected  CacheWriterConfiguration cacheWriterConfiguration
          The CacheWriterConfiguration.
protected  boolean clearOnFlush
          Sets whether the MemoryStore should be cleared when flush() is called on the cache - true by default.
static CacheWriterConfiguration DEFAULT_CACHE_WRITER_CONFIGURATION
          The default cacheWriterConfiguration
static boolean DEFAULT_CLEAR_ON_FLUSH
          Default value for clearOnFlush
static boolean DEFAULT_COPY_ON_READ
          Default value for copyOnRead
static boolean DEFAULT_COPY_ON_WRITE
          Default value for copyOnRead
static CopyStrategyConfiguration DEFAULT_COPY_STRATEGY_CONFIGURATION
          Default copyStrategyConfiguration
static int DEFAULT_DISK_ACCESS_STRIPES
          Default number of diskAccessStripes.
static boolean DEFAULT_DISK_PERSISTENT
          Default value for diskPersistent
static ElementValueComparatorConfiguration DEFAULT_ELEMENT_VALUE_COMPARATOR_CONFIGURATION
          Default elementComparatorConfiguration
static long DEFAULT_EXPIRY_THREAD_INTERVAL_SECONDS
          The default interval between runs of the expiry thread.
static boolean DEFAULT_LOGGING
          Logging is off by default.
static int DEFAULT_MAX_ELEMENTS_ON_DISK
          Default value for maxElementsOnDisk
static MemoryStoreEvictionPolicy DEFAULT_MEMORY_STORE_EVICTION_POLICY
          The default memory store eviction policy is LRU.
static int DEFAULT_SPOOL_BUFFER_SIZE
          Set a buffer size for the spool of approx 30MB.
static boolean DEFAULT_STATISTICS
          Default value for statistics
static CacheConfiguration.TransactionalMode DEFAULT_TRANSACTIONAL_MODE
          Default value for transactionalMode
static long DEFAULT_TTI
          Default value for tti
static long DEFAULT_TTL
          Default value for ttl
protected  int diskAccessStripes
          The number of concurrent disk access stripes.
protected  long diskExpiryThreadIntervalSeconds
          The interval in seconds between runs of the disk expiry thread.
protected  boolean diskPersistent
          For caches that overflow to disk, whether the disk cache persists between CacheManager instances.
protected  int diskSpoolBufferSizeMB
          The size of the disk spool used to buffer writes
protected  String diskStorePath
          The path where the disk store is located
protected  boolean eternal
          Sets whether elements are eternal.
protected  Set<CacheConfigurationListener> listeners
          The listeners for this configuration.
protected  boolean logging
          Indicates whether logging is enabled or not.
protected  int maxElementsInMemory
          the maximum objects to be held in the MemoryStore.
protected  int maxElementsOnDisk
          the maximum objects to be held in the DiskStore.
protected  String maxMemoryOffHeap
          Maximum size of the off heap memory allocated to this cache.
protected  MemoryStoreEvictionPolicy memoryStoreEvictionPolicy
          The policy used to evict elements from the MemoryStore.
protected  String name
          the name of the cache.
protected  boolean overflowToDisk
          whether elements can overflow to disk when the in-memory cache has reached the set limit.
protected  boolean overflowToOffHeap
          whether elements can overflow to off heap memory when the in-memory cache has reached the set limit.
protected  TerracottaConfiguration terracottaConfiguration
          The TerracottaConfiguration.
protected  long timeToIdleSeconds
          the time to idle for an element before it expires.
protected  long timeToLiveSeconds
          Sets the time to idle for an element before it expires.
 
Constructor Summary
CacheConfiguration()
          Default constructor.
CacheConfiguration(String name, int maxElementsInMemory)
          Create a new cache configuration.
 
Method Summary
 void addBootstrapCacheLoaderFactory(CacheConfiguration.BootstrapCacheLoaderFactoryConfiguration factory)
          Allows BeanHandler to add the CacheManagerEventListener to the configuration.
 void addCacheDecoratorFactory(CacheConfiguration.CacheDecoratorFactoryConfiguration factory)
          Used by BeanUtils to add each cacheDecoratorFactory to the cache configuration.
 void addCacheEventListenerFactory(CacheConfiguration.CacheEventListenerFactoryConfiguration factory)
          Used by BeanUtils to add cacheEventListenerFactory elements to the cache configuration.
 void addCacheExceptionHandlerFactory(CacheConfiguration.CacheExceptionHandlerFactoryConfiguration factory)
          Add the CacheExceptionHandlerFactory to the configuration.
 void addCacheExtensionFactory(CacheConfiguration.CacheExtensionFactoryConfiguration factory)
          Used by BeanUtils to add cacheExtensionFactory elements to the cache configuration.
 void addCacheLoaderFactory(CacheConfiguration.CacheLoaderFactoryConfiguration factory)
          Used by BeanUtils to add each cacheLoaderFactory to the cache configuration.
 void addCacheWriter(CacheWriterConfiguration cacheWriterConfiguration)
          Allows BeanHandler to add the CacheWriterConfiguration to the configuration.
 boolean addConfigurationListener(CacheConfigurationListener listener)
          Add a listener to this cache configuration
 void addCopyStrategy(CopyStrategyConfiguration copyStrategyConfiguration)
          Sets the CopyStrategyConfiguration for this cache
 void addElementValueComparator(ElementValueComparatorConfiguration elementValueComparatorConfiguration)
          Sets the ElementValueComparatorConfiguration for this cache
 void addSearchable(Searchable searchable)
          Add configuration to make this cache searchable
 void addTerracotta(TerracottaConfiguration terracottaConfiguration)
          Allows BeanHandler to add the TerracottaConfiguration to the configuration.
 CacheConfiguration bootstrapCacheLoaderFactory(CacheConfiguration.BootstrapCacheLoaderFactoryConfiguration factory)
           
 CacheConfiguration cacheEventListenerFactory(CacheConfiguration.CacheEventListenerFactoryConfiguration factory)
           
 CacheConfiguration cacheExceptionHandlerFactory(CacheConfiguration.CacheExceptionHandlerFactoryConfiguration factory)
           
 CacheConfiguration cacheExtensionFactory(CacheConfiguration.CacheExtensionFactoryConfiguration factory)
           
 CacheConfiguration cacheLoaderFactory(CacheConfiguration.CacheLoaderFactoryConfiguration factory)
           
 CacheConfiguration cacheWriter(CacheWriterConfiguration cacheWriterConfiguration)
           
 CacheConfiguration clearOnFlush(boolean clearOnFlush)
          Builder which sets whether the MemoryStore should be cleared when flush() is called on the cache - true by default.
 CacheConfiguration clone()
          Clones this object, following the usual contract.
 CacheConfiguration copyOnRead(boolean copyOnRead)
          Whether the Cache should copy elements it returns
 CacheConfiguration copyOnWrite(boolean copyOnWrite)
          Whether the Cache should copy elements it gets
 CacheConfiguration diskAccessStripes(int stripes)
          Builder which sets the number of disk stripes.
 CacheConfiguration diskExpiryThreadIntervalSeconds(long diskExpiryThreadIntervalSeconds)
          Builder which sets the interval in seconds between runs of the disk expiry thread.
 CacheConfiguration diskPersistent(boolean diskPersistent)
          Builder which sets whether the disk store persists between CacheManager instances.
 CacheConfiguration diskSpoolBufferSizeMB(int diskSpoolBufferSizeMB)
          Builder which sets the disk spool size, which is used to buffer writes to the DiskStore.
 CacheConfiguration diskStorePath(String diskStorePath)
          Builder which sets the path that will be used for the disk store.
 CacheConfiguration eternal(boolean eternal)
          Builder which sets whether elements are eternal.
 void freezeConfiguration()
          Freeze this configuration.
 CacheConfiguration.BootstrapCacheLoaderFactoryConfiguration getBootstrapCacheLoaderFactoryConfiguration()
          Accessor
 List<CacheConfiguration.CacheDecoratorFactoryConfiguration> getCacheDecoratorConfigurations()
          Accessor
 List getCacheEventListenerConfigurations()
          Accessor
 CacheConfiguration.CacheExceptionHandlerFactoryConfiguration getCacheExceptionHandlerFactoryConfiguration()
          Accessor
 List getCacheExtensionConfigurations()
          Accessor
 List getCacheLoaderConfigurations()
          Accessor
 long getCacheLoaderTimeoutMillis()
          Accessor
 CacheWriterConfiguration getCacheWriterConfiguration()
          Accessor
 ReadWriteCopyStrategy<Element> getCopyStrategy()
          Getter to the CopyStrategy set in the config (really? how?).
 CopyStrategyConfiguration getCopyStrategyConfiguration()
          Returns the copyStrategyConfiguration
 int getDiskAccessStripes()
          Accessor
 long getDiskExpiryThreadIntervalSeconds()
          Accessor
 int getDiskSpoolBufferSizeMB()
          Accessor
 String getDiskStorePath()
          Accessor
 ElementValueComparatorConfiguration getElementValueComparatorConfiguration()
          Returns the elementComparatorConfiguration
 boolean getLogging()
          Only used when cache is clustered with Terracotta
 int getMaxElementsInMemory()
          Accessor
 int getMaxElementsOnDisk()
          Accessor
 String getMaxMemoryOffHeap()
          Accessor
 long getMaxMemoryOffHeapInBytes()
          Accessor
 MemoryStoreEvictionPolicy getMemoryStoreEvictionPolicy()
          Accessor
 String getName()
          Accessor
 Searchable getSearchable()
          Get the search configuration for this cache (if any)
 Map<String,SearchAttribute> getSearchAttributes()
          Get the defined search attributes indexed by attribute name
 boolean getStatistics()
          Gets whether the cache's statistics will be enabled at startup
 TerracottaConfiguration getTerracottaConfiguration()
          Accessor
 TerracottaConfiguration.Consistency getTerracottaConsistency()
          Accessor
 TerracottaConfiguration.StorageStrategy getTerracottaStorageStrategy()
          Accessor
 long getTimeToIdleSeconds()
          Accessor
 long getTimeToLiveSeconds()
          Accessor
 CacheConfiguration.TransactionalMode getTransactionalMode()
          To what transactionalMode was the Cache set
 void internalSetDiskCapacity(int capacity)
          Intended for internal use only, and subject to change.
 void internalSetLogging(boolean logging)
          Intended for internal use only, and subject to change.
 void internalSetMemCapacity(int capacity)
          Intended for internal use only, and subject to change.
 void internalSetTimeToIdle(long timeToIdle)
          Intended for internal use only, and subject to change.
 void internalSetTimeToLive(long timeToLive)
          Intended for internal use only, and subject to change.
 boolean isClearOnFlush()
          Accessor
 boolean isCopyOnRead()
          Whether the Cache should copy elements it returns
 boolean isCopyOnWrite()
          Whether the Cache should copy elements it gets
 boolean isDiskPersistent()
          Accessor
 boolean isEternal()
          Accessor
 boolean isFrozen()
           
 boolean isLocalTransactional()
          Helper method to compute whether the cache is local transactional or not
 boolean isOverflowToDisk()
          Accessor
 boolean isOverflowToOffHeap()
          Accessor
 boolean isSearchable()
          Accessor
 boolean isTerracottaClustered()
          Helper method to compute whether the cache is clustered or not
 boolean isXaStrictTransactional()
          Helper method to compute whether the cache is XA transactional or not
 boolean isXaTransactional()
          Helper method to compute whether the cache is local_jta transactional or not
 CacheConfiguration logging(boolean enable)
          Builder to enable or disable logging for the cache

This property can be modified dynamically while the cache is operating.

 CacheConfiguration maxElementsInMemory(int maxElementsInMemory)
          Builder that sets the maximum objects to be held in memory (0 = no limit).
 CacheConfiguration maxElementsOnDisk(int maxElementsOnDisk)
          Builder which sets the maximum number elements on Disk.
 CacheConfiguration maxMemoryOffHeap(String maxMemoryOffHeap)
          Builder to set the max off heap memory size allocated for this cache.
 CacheConfiguration memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy memoryStoreEvictionPolicy)
          Builder which Sets the eviction policy.
 CacheConfiguration memoryStoreEvictionPolicy(String memoryStoreEvictionPolicy)
          Builder that sets the eviction policy.
 CacheConfiguration name(String name)
          Builder to set the name of the cache.
 CacheConfiguration overflowToDisk(boolean overflowToDisk)
          Builder which sets whether elements can overflow to disk when the in-memory cache has reached the set limit.
 CacheConfiguration overflowToOffHeap(boolean overflowToOffHeap)
          Builder to enable or disable offheap store for the cache.
 boolean removeConfigurationListener(CacheConfigurationListener listener)
          Remove the supplied cache configuration listener.
 CacheConfiguration searchable(Searchable searchable)
           
 void setCacheLoaderTimeoutMillis(long cacheLoaderTimeoutMillis)
          Sets the timeout for CacheLoader execution (0 = no timeout).
 void setClearOnFlush(boolean clearOnFlush)
          Sets whether the MemoryStore should be cleared when flush() is called on the cache - true by default.
 void setCopyOnRead(boolean copyOnRead)
          Whether the Cache should copy elements it returns
 void setCopyOnWrite(boolean copyOnWrite)
          Whether the Cache should copy elements it gets
 void setDiskAccessStripes(int stripes)
          Sets the number of disk stripes.
 void setDiskExpiryThreadIntervalSeconds(long diskExpiryThreadIntervalSeconds)
          Sets the interval in seconds between runs of the disk expiry thread.
 void setDiskPersistent(boolean diskPersistent)
          Sets whether the disk store persists between CacheManager instances.
 void setDiskSpoolBufferSizeMB(int diskSpoolBufferSizeMB)
          Sets the disk spool size, which is used to buffer writes to the DiskStore.
 void setDiskStorePath(String diskStorePath)
          Sets the path that will be used for the disk store.
 void setEternal(boolean eternal)
          Sets whether elements are eternal.
 void setLogging(boolean enable)
          Enables or disables logging for the cache

This property can be modified dynamically while the cache is operating.

 void setMaxElementsInMemory(int maxElementsInMemory)
          Sets the maximum objects to be held in memory (0 = no limit).
 void setMaxElementsOnDisk(int maxElementsOnDisk)
          Sets the maximum number elements on Disk.
 void setMaxMemoryOffHeap(String maxMemoryOffHeap)
          Sets the max off heap memory size allocated for this cache.
 void setMemoryStoreEvictionPolicy(String memoryStoreEvictionPolicy)
          Sets the eviction policy.
 void setMemoryStoreEvictionPolicyFromObject(MemoryStoreEvictionPolicy memoryStoreEvictionPolicy)
          Sets the eviction policy.
 void setName(String name)
          Sets the name of the cache.
 void setOverflowToDisk(boolean overflowToDisk)
          Sets whether elements can overflow to disk when the in-memory cache has reached the set limit.
 void setOverflowToOffHeap(boolean overflowToOffHeap)
          Enables or disables offheap store for the cache.
 void setStatistics(boolean enabled)
          Sets whether the cache's statistics are enabled.
 void setTimeToIdleSeconds(long timeToIdleSeconds)
          Sets the time to idle for an element before it expires.
 void setTimeToLiveSeconds(long timeToLiveSeconds)
          Sets the time to idle for an element before it expires.
 void setTransactionalMode(String transactionalMode)
          Sets the transactionalMode
 CacheConfiguration statistics(boolean statistics)
          Builder which sets whether the cache's statistics are enabled.
 CacheConfiguration terracotta(TerracottaConfiguration terracottaConfiguration)
           
 CacheConfiguration timeoutMillis(long timeoutMillis)
          Builder that sets the timeout for CacheLoader execution (0 = no timeout).
 CacheConfiguration timeToIdleSeconds(long timeToIdleSeconds)
          Builder which sets the time to idle for an element before it expires.
 CacheConfiguration timeToLiveSeconds(long timeToLiveSeconds)
          Builder which sets the time to idle for an element before it expires.
 CacheConfiguration transactionalMode(CacheConfiguration.TransactionalMode transactionalMode)
          Builder which sets the transactionalMode
 CacheConfiguration transactionalMode(String transactionalMode)
          Builder which sets the transactionalMode
 void validateCompleteConfiguration()
          Used to validate what should be a complete Cache Configuration.
 void validateConfiguration()
          Used to validate a Cache Configuration.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CLEAR_ON_FLUSH

public static final boolean DEFAULT_CLEAR_ON_FLUSH
Default value for clearOnFlush

See Also:
Constant Field Values

DEFAULT_EXPIRY_THREAD_INTERVAL_SECONDS

public static final long DEFAULT_EXPIRY_THREAD_INTERVAL_SECONDS
The default interval between runs of the expiry thread.

See Also:
Constant Field Values

DEFAULT_SPOOL_BUFFER_SIZE

public static final int DEFAULT_SPOOL_BUFFER_SIZE
Set a buffer size for the spool of approx 30MB.

See Also:
Constant Field Values

DEFAULT_DISK_ACCESS_STRIPES

public static final int DEFAULT_DISK_ACCESS_STRIPES
Default number of diskAccessStripes.

See Also:
Constant Field Values

DEFAULT_LOGGING

public static final boolean DEFAULT_LOGGING
Logging is off by default.

See Also:
Constant Field Values

DEFAULT_MEMORY_STORE_EVICTION_POLICY

public static final MemoryStoreEvictionPolicy DEFAULT_MEMORY_STORE_EVICTION_POLICY
The default memory store eviction policy is LRU.


DEFAULT_CACHE_WRITER_CONFIGURATION

public static final CacheWriterConfiguration DEFAULT_CACHE_WRITER_CONFIGURATION
The default cacheWriterConfiguration


DEFAULT_COPY_ON_READ

public static final boolean DEFAULT_COPY_ON_READ
Default value for copyOnRead

See Also:
Constant Field Values

DEFAULT_COPY_ON_WRITE

public static final boolean DEFAULT_COPY_ON_WRITE
Default value for copyOnRead

See Also:
Constant Field Values

DEFAULT_TTL

public static final long DEFAULT_TTL
Default value for ttl

See Also:
Constant Field Values

DEFAULT_TTI

public static final long DEFAULT_TTI
Default value for tti

See Also:
Constant Field Values

DEFAULT_MAX_ELEMENTS_ON_DISK

public static final int DEFAULT_MAX_ELEMENTS_ON_DISK
Default value for maxElementsOnDisk

See Also:
Constant Field Values

DEFAULT_TRANSACTIONAL_MODE

public static final CacheConfiguration.TransactionalMode DEFAULT_TRANSACTIONAL_MODE
Default value for transactionalMode


DEFAULT_STATISTICS

public static final boolean DEFAULT_STATISTICS
Default value for statistics

See Also:
Constant Field Values

DEFAULT_DISK_PERSISTENT

public static final boolean DEFAULT_DISK_PERSISTENT
Default value for diskPersistent

See Also:
Constant Field Values

DEFAULT_COPY_STRATEGY_CONFIGURATION

public static final CopyStrategyConfiguration DEFAULT_COPY_STRATEGY_CONFIGURATION
Default copyStrategyConfiguration


DEFAULT_ELEMENT_VALUE_COMPARATOR_CONFIGURATION

public static final ElementValueComparatorConfiguration DEFAULT_ELEMENT_VALUE_COMPARATOR_CONFIGURATION
Default elementComparatorConfiguration


name

protected volatile String name
the name of the cache.


cacheLoaderTimeoutMillis

protected volatile long cacheLoaderTimeoutMillis
Timeout in milliseconds for CacheLoader related calls


maxElementsInMemory

protected volatile int maxElementsInMemory
the maximum objects to be held in the MemoryStore.

0 translates to no-limit.


maxElementsOnDisk

protected volatile int maxElementsOnDisk
the maximum objects to be held in the DiskStore.

0 translates to no-limit.


memoryStoreEvictionPolicy

protected volatile MemoryStoreEvictionPolicy memoryStoreEvictionPolicy
The policy used to evict elements from the MemoryStore. This can be one of:
  1. LRU - least recently used
  2. LFU - Less frequently used
  3. FIFO - first in first out, the oldest element by creation time
The default value is LRU

Since:
1.2

clearOnFlush

protected volatile boolean clearOnFlush
Sets whether the MemoryStore should be cleared when flush() is called on the cache - true by default.


eternal

protected volatile boolean eternal
Sets whether elements are eternal. If eternal, timeouts are ignored and the element is never expired.


timeToIdleSeconds

protected volatile long timeToIdleSeconds
the time to idle for an element before it expires. Is only used if the element is not eternal.A value of 0 means do not check for idling.


timeToLiveSeconds

protected volatile long timeToLiveSeconds
Sets the time to idle for an element before it expires. Is only used if the element is not eternal. This attribute is optional in the configuration. A value of 0 means do not check time to live.


overflowToDisk

protected volatile boolean overflowToDisk
whether elements can overflow to disk when the in-memory cache has reached the set limit.


diskPersistent

protected volatile boolean diskPersistent
For caches that overflow to disk, whether the disk cache persists between CacheManager instances.


diskStorePath

protected volatile String diskStorePath
The path where the disk store is located


diskSpoolBufferSizeMB

protected volatile int diskSpoolBufferSizeMB
The size of the disk spool used to buffer writes


diskAccessStripes

protected volatile int diskAccessStripes
The number of concurrent disk access stripes.


diskExpiryThreadIntervalSeconds

protected volatile long diskExpiryThreadIntervalSeconds
The interval in seconds between runs of the disk expiry thread.

2 minutes is the default. This is not the same thing as time to live or time to idle. When the thread runs it checks these things. So this value is how often we check for expiry.


logging

protected volatile boolean logging
Indicates whether logging is enabled or not. False by default. Only used when cache is clustered with Terracotta.


overflowToOffHeap

protected volatile boolean overflowToOffHeap
whether elements can overflow to off heap memory when the in-memory cache has reached the set limit.


maxMemoryOffHeap

protected volatile String maxMemoryOffHeap
Maximum size of the off heap memory allocated to this cache.


cacheEventListenerConfigurations

protected volatile List<CacheConfiguration.CacheEventListenerFactoryConfiguration> cacheEventListenerConfigurations
The event listener factories added by BeanUtils.


cacheExtensionConfigurations

protected volatile List<CacheConfiguration.CacheExtensionFactoryConfiguration> cacheExtensionConfigurations
The cache extension factories added by BeanUtils.


bootstrapCacheLoaderFactoryConfiguration

protected CacheConfiguration.BootstrapCacheLoaderFactoryConfiguration bootstrapCacheLoaderFactoryConfiguration
The BootstrapCacheLoaderFactoryConfiguration.


cacheExceptionHandlerFactoryConfiguration

protected CacheConfiguration.CacheExceptionHandlerFactoryConfiguration cacheExceptionHandlerFactoryConfiguration
The CacheExceptionHandlerFactoryConfiguration.


terracottaConfiguration

protected TerracottaConfiguration terracottaConfiguration
The TerracottaConfiguration.


cacheWriterConfiguration

protected CacheWriterConfiguration cacheWriterConfiguration
The CacheWriterConfiguration.


cacheLoaderConfigurations

protected volatile List<CacheConfiguration.CacheLoaderFactoryConfiguration> cacheLoaderConfigurations
The cache loader factories added by BeanUtils.


cacheDecoratorConfigurations

protected volatile List<CacheConfiguration.CacheDecoratorFactoryConfiguration> cacheDecoratorConfigurations
The cache decorator factories added by BeanUtils.


listeners

protected volatile Set<CacheConfigurationListener> listeners
The listeners for this configuration.

Constructor Detail

CacheConfiguration

public CacheConfiguration()
Default constructor.

Note that an empty Cache is not valid and must have extra configuration added which can be done through the fluent methods in this class. Call validateConfiguration() to check your configuration.

See Also:
validateCompleteConfiguration()

CacheConfiguration

public CacheConfiguration(String name,
                          int maxElementsInMemory)
Create a new cache configuration.

Extra configuration can added after construction via the fluent methods in this class. Call validateConfiguration() to check your configuration.

Parameters:
name - the name of the cache. Note that "default" is a reserved name for the defaultCache.
maxElementsInMemory - the maximum number of elements in memory, before they are evicted (0 == no limit)
See Also:
validateCompleteConfiguration()
Method Detail

clone

public CacheConfiguration clone()
Clones this object, following the usual contract.

Overrides:
clone in class Object
Returns:
a copy, which independent other than configurations than cannot change.

setName

public final void setName(String name)
Sets the name of the cache.

Parameters:
name - the cache name. This must be unique. The / character is illegal. The # character does not work with RMI replication.

name

public final CacheConfiguration name(String name)
Builder to set the name of the cache.

Parameters:
name - the cache name. This must be unique. The / character is illegal. The # character does not work with RMI replication.
Returns:
this configuration instance
See Also:
setName(String)

setLogging

public final void setLogging(boolean enable)
Enables or disables logging for the cache

This property can be modified dynamically while the cache is operating. Only used when cache is clustered with Terracotta

Parameters:
enable - If true, enables logging otherwise disables logging

setOverflowToOffHeap

public final void setOverflowToOffHeap(boolean overflowToOffHeap)
Enables or disables offheap store for the cache.

Parameters:
overflowToOffHeap - If true, enables offheap store otherwise disables it.

overflowToOffHeap

public CacheConfiguration overflowToOffHeap(boolean overflowToOffHeap)
Builder to enable or disable offheap store for the cache.

Parameters:
overflowToOffHeap - If true, enables offheap store otherwise disables it.
Returns:
this configuration instance
See Also:
setOverflowToOffHeap(boolean)

setMaxMemoryOffHeap

public final void setMaxMemoryOffHeap(String maxMemoryOffHeap)
Sets the max off heap memory size allocated for this cache.

Parameters:
maxMemoryOffHeap - the max off heap memory size allocated for this cache.

maxMemoryOffHeap

public CacheConfiguration maxMemoryOffHeap(String maxMemoryOffHeap)
Builder to set the max off heap memory size allocated for this cache.

Parameters:
maxMemoryOffHeap - the max off heap memory size allocated for this cache.
Returns:
this configuration instance
See Also:
setMaxMemoryOffHeap(String)

logging

public final CacheConfiguration logging(boolean enable)
Builder to enable or disable logging for the cache

This property can be modified dynamically while the cache is operating. Only used when cache is clustered with Terracotta

Parameters:
enable - If true, enables logging otherwise disables logging
Returns:
this configuration instance
See Also:
setLogging(boolean)

setMaxElementsInMemory

public final void setMaxElementsInMemory(int maxElementsInMemory)
Sets the maximum objects to be held in memory (0 = no limit).

This property can be modified dynamically while the cache is operating.

Parameters:
maxElementsInMemory - The maximum number of elements in memory, before they are evicted (0 == no limit)

maxElementsInMemory

public final CacheConfiguration maxElementsInMemory(int maxElementsInMemory)
Builder that sets the maximum objects to be held in memory (0 = no limit).

This property can be modified dynamically while the cache is operating.

Parameters:
maxElementsInMemory - The maximum number of elements in memory, before they are evicted (0 == no limit)
Returns:
this configuration instance

setCacheLoaderTimeoutMillis

public final void setCacheLoaderTimeoutMillis(long cacheLoaderTimeoutMillis)
Sets the timeout for CacheLoader execution (0 = no timeout).

Parameters:
cacheLoaderTimeoutMillis - the timeout in milliseconds.

timeoutMillis

public CacheConfiguration timeoutMillis(long timeoutMillis)
Builder that sets the timeout for CacheLoader execution (0 = no timeout).

Parameters:
timeoutMillis - the timeout in milliseconds.
Returns:
this configuration instance

setMemoryStoreEvictionPolicy

public final void setMemoryStoreEvictionPolicy(String memoryStoreEvictionPolicy)
Sets the eviction policy. An invalid argument will set it to null.

Parameters:
memoryStoreEvictionPolicy - a String representation of the policy. One of "LRU", "LFU" or "FIFO".

memoryStoreEvictionPolicy

public final CacheConfiguration memoryStoreEvictionPolicy(String memoryStoreEvictionPolicy)
Builder that sets the eviction policy. An invalid argument will set it to null.

Parameters:
memoryStoreEvictionPolicy - a String representation of the policy. One of "LRU", "LFU" or "FIFO".
Returns:
this configuration instance
See Also:
setMemoryStoreEvictionPolicy(String)

setMemoryStoreEvictionPolicyFromObject

public final void setMemoryStoreEvictionPolicyFromObject(MemoryStoreEvictionPolicy memoryStoreEvictionPolicy)
Sets the eviction policy. This method has a strange name to workaround a problem with XML parsing.


memoryStoreEvictionPolicy

public final CacheConfiguration memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy memoryStoreEvictionPolicy)
Builder which Sets the eviction policy. An invalid argument will set it to null.

Returns:
this configuration instance
See Also:
setMemoryStoreEvictionPolicyFromObject(MemoryStoreEvictionPolicy)

setClearOnFlush

public final void setClearOnFlush(boolean clearOnFlush)
Sets whether the MemoryStore should be cleared when flush() is called on the cache - true by default.

Parameters:
clearOnFlush - true to clear on flush

clearOnFlush

public final CacheConfiguration clearOnFlush(boolean clearOnFlush)
Builder which sets whether the MemoryStore should be cleared when flush() is called on the cache - true by default.

Parameters:
clearOnFlush - true to clear on flush
Returns:
this configuration instance
See Also:
setClearOnFlush(boolean)

setEternal

public final void setEternal(boolean eternal)
Sets whether elements are eternal. If eternal, timeouts are ignored and the element is never expired. False by default.

Parameters:
eternal - true for eternal

eternal

public final CacheConfiguration eternal(boolean eternal)
Builder which sets whether elements are eternal. If eternal, timeouts are ignored and the element is never expired. False by default.

Parameters:
eternal - true for eternal
Returns:
this configuration instance
See Also:
setEternal(boolean)

setTimeToIdleSeconds

public final void setTimeToIdleSeconds(long timeToIdleSeconds)
Sets the time to idle for an element before it expires. Is only used if the element is not eternal. This can be overidden in Element

This property can be modified dynamically while the cache is operating.

Parameters:
timeToIdleSeconds - the default amount of time to live for an element from its last accessed or modified date

timeToIdleSeconds

public final CacheConfiguration timeToIdleSeconds(long timeToIdleSeconds)
Builder which sets the time to idle for an element before it expires. Is only used if the element is not eternal. This default can be overridden in Element

This property can be modified dynamically while the cache is operating.

Parameters:
timeToIdleSeconds - the default amount of time to live for an element from its last accessed or modified date
Returns:
this configuration instance
See Also:
setTimeToIdleSeconds(long)

setTimeToLiveSeconds

public final void setTimeToLiveSeconds(long timeToLiveSeconds)
Sets the time to idle for an element before it expires. Is only used if the element is not eternal. This default can be overridden in Element

This property can be modified dynamically while the cache is operating.

Parameters:
timeToLiveSeconds - the default amount of time to live for an element from its creation date

timeToLiveSeconds

public final CacheConfiguration timeToLiveSeconds(long timeToLiveSeconds)
Builder which sets the time to idle for an element before it expires. Is only used if the element is not eternal. This default can be overridden in Element

This property can be modified dynamically while the cache is operating.

Parameters:
timeToLiveSeconds - the default amount of time to live for an element from its creation date
Returns:
this configuration instance
See Also:
setTimeToLiveSeconds(long)

setOverflowToDisk

public final void setOverflowToDisk(boolean overflowToDisk)
Sets whether elements can overflow to disk when the in-memory cache has reached the set limit.

Parameters:
overflowToDisk - whether to use the disk store

overflowToDisk

public final CacheConfiguration overflowToDisk(boolean overflowToDisk)
Builder which sets whether elements can overflow to disk when the in-memory cache has reached the set limit.

Parameters:
overflowToDisk - whether to use the disk store
Returns:
this configuration instance
See Also:
setOverflowToDisk(boolean)

setDiskPersistent

public final void setDiskPersistent(boolean diskPersistent)
Sets whether the disk store persists between CacheManager instances. Note that this operates independently of overflowToDisk.

Parameters:
diskPersistent - whether to persist the cache to disk between JVM restarts

diskPersistent

public final CacheConfiguration diskPersistent(boolean diskPersistent)
Builder which sets whether the disk store persists between CacheManager instances. Note that this operates independently of overflowToDisk.

Parameters:
diskPersistent - whether to persist the cache to disk between JVM restarts.
Returns:
this configuration instance
See Also:
setDiskPersistent(boolean)

setDiskStorePath

public final void setDiskStorePath(String diskStorePath)
Sets the path that will be used for the disk store. If you use this feature, beware of collisions with CacheManagers potentially have a Cache with the same name!

Parameters:
diskStorePath - if null, CacheManager sets it using setter injection.

diskStorePath

public final CacheConfiguration diskStorePath(String diskStorePath)
Builder which sets the path that will be used for the disk store. If you use this feature, beware of collisions with CacheManagers potentially have a Cache with the same name!

Parameters:
diskStorePath - if null, CacheManager sets it using setter injection.
Returns:
this configuration instance
See Also:
setDiskStorePath(String)

setDiskSpoolBufferSizeMB

public void setDiskSpoolBufferSizeMB(int diskSpoolBufferSizeMB)
Sets the disk spool size, which is used to buffer writes to the DiskStore. If not set it defaults to DEFAULT_SPOOL_BUFFER_SIZE

Parameters:
diskSpoolBufferSizeMB - a positive number

diskSpoolBufferSizeMB

public final CacheConfiguration diskSpoolBufferSizeMB(int diskSpoolBufferSizeMB)
Builder which sets the disk spool size, which is used to buffer writes to the DiskStore. If not set it defaults to DEFAULT_SPOOL_BUFFER_SIZE

Parameters:
diskSpoolBufferSizeMB - a positive number
Returns:
this configuration instance
See Also:
setDiskSpoolBufferSizeMB(int)

setDiskAccessStripes

public void setDiskAccessStripes(int stripes)
Sets the number of disk stripes. RandomAccessFiles used to access the data file. By default there is one stripe.

Parameters:
stripes - number of stripes (rounded up to a power-of-2)

diskAccessStripes

public final CacheConfiguration diskAccessStripes(int stripes)
Builder which sets the number of disk stripes. RandomAccessFiles used to access the data file. By default there is one stripe.

Returns:
this configuration instance
See Also:
setDiskAccessStripes(int)

setMaxElementsOnDisk

public void setMaxElementsOnDisk(int maxElementsOnDisk)
Sets the maximum number elements on Disk. 0 means unlimited.

This property can be modified dynamically while the cache is operating.

Parameters:
maxElementsOnDisk - the maximum number of Elements to allow on the disk. 0 means unlimited.

maxElementsOnDisk

public final CacheConfiguration maxElementsOnDisk(int maxElementsOnDisk)
Builder which sets the maximum number elements on Disk. 0 means unlimited.

This property can be modified dynamically while the cache is operating.

Parameters:
maxElementsOnDisk - the maximum number of Elements to allow on the disk. 0 means unlimited.
Returns:
this configuration instance
See Also:
setMaxElementsOnDisk(int)

setDiskExpiryThreadIntervalSeconds

public final void setDiskExpiryThreadIntervalSeconds(long diskExpiryThreadIntervalSeconds)
Sets the interval in seconds between runs of the disk expiry thread.

2 minutes is the default. This is not the same thing as time to live or time to idle. When the thread runs it checks these things. So this value is how often we check for expiry.


diskExpiryThreadIntervalSeconds

public final CacheConfiguration diskExpiryThreadIntervalSeconds(long diskExpiryThreadIntervalSeconds)
Builder which sets the interval in seconds between runs of the disk expiry thread.

2 minutes is the default. This is not the same thing as time to live or time to idle. When the thread runs it checks these things. So this value is how often we check for expiry.

Returns:
this configuration instance
See Also:
setDiskExpiryThreadIntervalSeconds(long)

freezeConfiguration

public void freezeConfiguration()
Freeze this configuration. Any subsequent changes will throw a CacheException


isFrozen

public boolean isFrozen()
Returns:
true is this configuration is frozen - it cannot be changed dynamically.

getCopyStrategy

public ReadWriteCopyStrategy<Element> getCopyStrategy()
Getter to the CopyStrategy set in the config (really? how?). This will always return the same unique instance per cache

Returns:
the ReadWriteCopyStrategy for instance for this cache

copyOnRead

public CacheConfiguration copyOnRead(boolean copyOnRead)
Whether the Cache should copy elements it returns

Parameters:
copyOnRead - true, if copyOnRead

isCopyOnRead

public boolean isCopyOnRead()
Whether the Cache should copy elements it returns

Returns:
true, is copyOnRead

setCopyOnRead

public void setCopyOnRead(boolean copyOnRead)
Whether the Cache should copy elements it returns

Parameters:
copyOnRead - true, if copyOnRead

copyOnWrite

public CacheConfiguration copyOnWrite(boolean copyOnWrite)
Whether the Cache should copy elements it gets

Parameters:
copyOnWrite - true, if copyOnWrite

isCopyOnWrite

public boolean isCopyOnWrite()
Whether the Cache should copy elements it gets

Returns:
true, if copyOnWrite

setCopyOnWrite

public void setCopyOnWrite(boolean copyOnWrite)
Whether the Cache should copy elements it gets

Parameters:
copyOnWrite - true, if copyOnWrite

addCopyStrategy

public void addCopyStrategy(CopyStrategyConfiguration copyStrategyConfiguration)
Sets the CopyStrategyConfiguration for this cache

Parameters:
copyStrategyConfiguration - the CopyStrategy Configuration

addElementValueComparator

public void addElementValueComparator(ElementValueComparatorConfiguration elementValueComparatorConfiguration)
Sets the ElementValueComparatorConfiguration for this cache

Parameters:
elementValueComparatorConfiguration - the ElementComparator Configuration

addSearchable

public final void addSearchable(Searchable searchable)
Add configuration to make this cache searchable

Parameters:
searchable - search config to add

getCopyStrategyConfiguration

public CopyStrategyConfiguration getCopyStrategyConfiguration()
Returns the copyStrategyConfiguration

Returns:
the copyStrategyConfiguration

getElementValueComparatorConfiguration

public ElementValueComparatorConfiguration getElementValueComparatorConfiguration()
Returns the elementComparatorConfiguration

Returns:
the elementComparatorConfiguration

addCacheEventListenerFactory

public final void addCacheEventListenerFactory(CacheConfiguration.CacheEventListenerFactoryConfiguration factory)
Used by BeanUtils to add cacheEventListenerFactory elements to the cache configuration.


cacheEventListenerFactory

public final CacheConfiguration cacheEventListenerFactory(CacheConfiguration.CacheEventListenerFactoryConfiguration factory)
Returns:
this configuration instance
See Also:
addCacheEventListenerFactory(CacheEventListenerFactoryConfiguration)

addCacheExtensionFactory

public final void addCacheExtensionFactory(CacheConfiguration.CacheExtensionFactoryConfiguration factory)
Used by BeanUtils to add cacheExtensionFactory elements to the cache configuration.


cacheExtensionFactory

public final CacheConfiguration cacheExtensionFactory(CacheConfiguration.CacheExtensionFactoryConfiguration factory)
Returns:
this configuration instance
See Also:
addCacheExtensionFactory(CacheExtensionFactoryConfiguration)

addBootstrapCacheLoaderFactory

public final void addBootstrapCacheLoaderFactory(CacheConfiguration.BootstrapCacheLoaderFactoryConfiguration factory)
Allows BeanHandler to add the CacheManagerEventListener to the configuration.


bootstrapCacheLoaderFactory

public final CacheConfiguration bootstrapCacheLoaderFactory(CacheConfiguration.BootstrapCacheLoaderFactoryConfiguration factory)
Returns:
this configuration instance
See Also:
addBootstrapCacheLoaderFactory(BootstrapCacheLoaderFactoryConfiguration)

addCacheExceptionHandlerFactory

public final void addCacheExceptionHandlerFactory(CacheConfiguration.CacheExceptionHandlerFactoryConfiguration factory)
Add the CacheExceptionHandlerFactory to the configuration.

Note that this will not have any effect when creating a cache solely through its constructed. The exception handler will only be taken into account when ConfigurationHelper is used, for example through CacheManager.


cacheExceptionHandlerFactory

public final CacheConfiguration cacheExceptionHandlerFactory(CacheConfiguration.CacheExceptionHandlerFactoryConfiguration factory)
Returns:
this configuration instance
See Also:
addCacheExceptionHandlerFactory(CacheExceptionHandlerFactoryConfiguration)

addCacheLoaderFactory

public final void addCacheLoaderFactory(CacheConfiguration.CacheLoaderFactoryConfiguration factory)
Used by BeanUtils to add each cacheLoaderFactory to the cache configuration.

Parameters:
factory -

addCacheDecoratorFactory

public final void addCacheDecoratorFactory(CacheConfiguration.CacheDecoratorFactoryConfiguration factory)
Used by BeanUtils to add each cacheDecoratorFactory to the cache configuration.

Parameters:
factory -

cacheLoaderFactory

public final CacheConfiguration cacheLoaderFactory(CacheConfiguration.CacheLoaderFactoryConfiguration factory)
Returns:
this configuration instance
See Also:
addCacheLoaderFactory(CacheLoaderFactoryConfiguration)

addTerracotta

public final void addTerracotta(TerracottaConfiguration terracottaConfiguration)
Allows BeanHandler to add the TerracottaConfiguration to the configuration.


terracotta

public final CacheConfiguration terracotta(TerracottaConfiguration terracottaConfiguration)
Returns:
this configuration instance
See Also:
addTerracotta(TerracottaConfiguration)

searchable

public final CacheConfiguration searchable(Searchable searchable)
Parameters:
searchable -
Returns:
this
See Also:
addSearchable(Searchable)

addCacheWriter

public final void addCacheWriter(CacheWriterConfiguration cacheWriterConfiguration)
Allows BeanHandler to add the CacheWriterConfiguration to the configuration.


cacheWriter

public final CacheConfiguration cacheWriter(CacheWriterConfiguration cacheWriterConfiguration)
Returns:
this configuration instance
See Also:
addCacheWriter(CacheWriterConfiguration)

setTransactionalMode

public final void setTransactionalMode(String transactionalMode)
Sets the transactionalMode

Parameters:
transactionalMode - OFF or XA

transactionalMode

public final CacheConfiguration transactionalMode(String transactionalMode)
Builder which sets the transactionalMode

Parameters:
transactionalMode - one of OFF or XA
Returns:
this configuration instance
See Also:
setTransactionalMode(String)

transactionalMode

public final CacheConfiguration transactionalMode(CacheConfiguration.TransactionalMode transactionalMode)
Builder which sets the transactionalMode

Parameters:
transactionalMode - one of OFF or XA enum values
Returns:
this configuration instance
See Also:
setTransactionalMode(String)

setStatistics

public final void setStatistics(boolean enabled)
Sets whether the cache's statistics are enabled. at startup


statistics

public final CacheConfiguration statistics(boolean statistics)
Builder which sets whether the cache's statistics are enabled.

Returns:
this configuration instance
See Also:
setStatistics(boolean)

getStatistics

public final boolean getStatistics()
Gets whether the cache's statistics will be enabled at startup


validateCompleteConfiguration

public void validateCompleteConfiguration()
Used to validate what should be a complete Cache Configuration.


validateConfiguration

public void validateConfiguration()
Used to validate a Cache Configuration.


getName

public String getName()
Accessor


getMaxElementsInMemory

public int getMaxElementsInMemory()
Accessor


getCacheLoaderTimeoutMillis

public long getCacheLoaderTimeoutMillis()
Accessor


getMaxElementsOnDisk

public int getMaxElementsOnDisk()
Accessor


getMemoryStoreEvictionPolicy

public MemoryStoreEvictionPolicy getMemoryStoreEvictionPolicy()
Accessor


isClearOnFlush

public boolean isClearOnFlush()
Accessor


isEternal

public boolean isEternal()
Accessor


getTimeToIdleSeconds

public long getTimeToIdleSeconds()
Accessor


getTimeToLiveSeconds

public long getTimeToLiveSeconds()
Accessor


isOverflowToDisk

public boolean isOverflowToDisk()
Accessor


isDiskPersistent

public boolean isDiskPersistent()
Accessor


isSearchable

public boolean isSearchable()
Accessor


getDiskStorePath

public String getDiskStorePath()
Accessor


getDiskSpoolBufferSizeMB

public int getDiskSpoolBufferSizeMB()
Accessor


getDiskExpiryThreadIntervalSeconds

public long getDiskExpiryThreadIntervalSeconds()
Accessor


getDiskAccessStripes

public int getDiskAccessStripes()
Accessor


getLogging

public boolean getLogging()
Only used when cache is clustered with Terracotta

Returns:
true if logging is enabled otherwise false

isOverflowToOffHeap

public boolean isOverflowToOffHeap()
Accessor

Returns:
true if offheap store is enabled, otherwise false.

getMaxMemoryOffHeap

public String getMaxMemoryOffHeap()
Accessor

Returns:
the max memory of the offheap store for this cache.

getMaxMemoryOffHeapInBytes

public long getMaxMemoryOffHeapInBytes()
Accessor

Returns:
the max memory of the offheap store for this cache, in bytes.
See Also:
getMaxMemoryOffHeap()

getCacheEventListenerConfigurations

public List getCacheEventListenerConfigurations()
Accessor


getCacheExtensionConfigurations

public List getCacheExtensionConfigurations()
Accessor

Returns:
the configuration

getCacheLoaderConfigurations

public List getCacheLoaderConfigurations()
Accessor

Returns:
the configuration

getCacheDecoratorConfigurations

public List<CacheConfiguration.CacheDecoratorFactoryConfiguration> getCacheDecoratorConfigurations()
Accessor

Returns:
the configuration

getBootstrapCacheLoaderFactoryConfiguration

public CacheConfiguration.BootstrapCacheLoaderFactoryConfiguration getBootstrapCacheLoaderFactoryConfiguration()
Accessor

Returns:
the configuration

getCacheExceptionHandlerFactoryConfiguration

public CacheConfiguration.CacheExceptionHandlerFactoryConfiguration getCacheExceptionHandlerFactoryConfiguration()
Accessor

Returns:
the configuration

getTerracottaConfiguration

public TerracottaConfiguration getTerracottaConfiguration()
Accessor

Returns:
the terracotta configuration

getCacheWriterConfiguration

public CacheWriterConfiguration getCacheWriterConfiguration()
Accessor

Returns:
the writer configuration

isTerracottaClustered

public boolean isTerracottaClustered()
Helper method to compute whether the cache is clustered or not

Returns:
True if the <terracotta/> element exists with clustered="true"

getTerracottaConsistency

public TerracottaConfiguration.Consistency getTerracottaConsistency()
Accessor

Returns:
the CoherenceMode if Terracotta-clustered or null

getTerracottaStorageStrategy

public TerracottaConfiguration.StorageStrategy getTerracottaStorageStrategy()
Accessor

Returns:
the StorageStrategy if Terracotta-clustered or null

getTransactionalMode

public final CacheConfiguration.TransactionalMode getTransactionalMode()
To what transactionalMode was the Cache set

Returns:
transactionaMode

isXaStrictTransactional

public boolean isXaStrictTransactional()
Helper method to compute whether the cache is XA transactional or not

Returns:
true if transactionalMode="xa_strict"

isLocalTransactional

public boolean isLocalTransactional()
Helper method to compute whether the cache is local transactional or not

Returns:
true if transactionalMode="local"

isXaTransactional

public boolean isXaTransactional()
Helper method to compute whether the cache is local_jta transactional or not

Returns:
true if transactionalMode="xa"

addConfigurationListener

public boolean addConfigurationListener(CacheConfigurationListener listener)
Add a listener to this cache configuration

Parameters:
listener - listener instance to add
Returns:
true if a listener was added

removeConfigurationListener

public boolean removeConfigurationListener(CacheConfigurationListener listener)
Remove the supplied cache configuration listener.

Parameters:
listener - listener to remove
Returns:
true if a listener was removed

internalSetTimeToIdle

public void internalSetTimeToIdle(long timeToIdle)
Intended for internal use only, and subject to change. This is required so that changes in store implementation's config (probably from other nodes) can propagate up to here


internalSetTimeToLive

public void internalSetTimeToLive(long timeToLive)
Intended for internal use only, and subject to change.


internalSetMemCapacity

public void internalSetMemCapacity(int capacity)
Intended for internal use only, and subject to change.


internalSetDiskCapacity

public void internalSetDiskCapacity(int capacity)
Intended for internal use only, and subject to change.


internalSetLogging

public void internalSetLogging(boolean logging)
Intended for internal use only, and subject to change.


getSearchAttributes

public Map<String,SearchAttribute> getSearchAttributes()
Get the defined search attributes indexed by attribute name

Returns:
search attributes

getSearchable

public Searchable getSearchable()
Get the search configuration for this cache (if any)

Returns:
search config (may be null)

ehcache

true