org.apache.ignite.configuration

## Class CacheConfiguration<K,V>

- java.lang.Object
- - javax.cache.configuration.MutableConfiguration<K,V>
  - - org.apache.ignite.configuration.CacheConfiguration<K,V>

All Implemented Interfaces:
  Serializable, javax.cache.configuration.CompleteConfiguration<K,V>, javax.cache.configuration.Configuration<K,V>

    public class CacheConfiguration<K,V>
    extends javax.cache.configuration.MutableConfiguration<K,V>

This class defines grid cache configuration. This configuration is passed to grid via `IgniteConfiguration.getCacheConfiguration()` method. It defines all configuration parameters required to start a cache within grid instance. You can have multiple caches configured with different names within one grid.

Cache configuration is set on `IgniteConfiguration.setCacheConfiguration(CacheConfiguration...)` method. This adapter is a simple bean and can be configured from Spring XML files (or other DI frameworks).

Note that absolutely all configuration properties are optional, so users should only change what they need.

See Also:
  Serialized Form

### Nested Class Summary

Nested Classes
`static class` `CacheConfiguration.IgniteAllNodesPredicate` Filter that accepts all nodes.
`static class` `CacheConfiguration.IgniteServerNodePredicate` Filter that accepts only server nodes.

### Field Summary

Fields
`static IgnitePredicate<ClusterNode>` `ALL_NODES` Filter that accepts all nodes.
`static int` `DFLT_BACKUPS` Default number of backups.
`static CacheAtomicityMode` `DFLT_CACHE_ATOMICITY_MODE` Default atomicity mode.
`static CacheMode` `DFLT_CACHE_MODE` Default caching mode.
`static int` `DFLT_CACHE_SIZE` Default cache size to use with eviction policy.
`static boolean` `DFLT_COPY_ON_READ` Default value for 'copyOnRead' flag.
`static boolean` `DFLT_EAGER_TTL` Default value for eager ttl flag.
`static int` `DFLT_EVICT_KEY_BUFFER_SIZE` Default eviction key buffer size for batching synchronized evicts.
`static boolean` `DFLT_EVICT_SYNCHRONIZED` Default eviction synchronized flag.
`static int` `DFLT_EVICT_SYNCHRONIZED_CONCURRENCY_LEVEL` Default synchronous eviction concurrency level.
`static long` `DFLT_EVICT_SYNCHRONIZED_TIMEOUT` Default synchronous eviction timeout in milliseconds.
`static boolean` `DFLT_INVALIDATE` Default value for 'invalidate' flag that indicates if this is invalidation-based cache.
`static boolean` `DFLT_LOAD_PREV_VAL` Default value for load previous value flag.
`static long` `DFLT_LOCK_TIMEOUT` Default lock timeout.
`static long` `DFLT_LONG_QRY_WARN_TIMEOUT` Default timeout after which long query warning will be printed.
`static int` `DFLT_MAX_CONCURRENT_ASYNC_OPS` Default value for 'maxConcurrentAsyncOps'.
`static float` `DFLT_MAX_EVICTION_OVERFLOW_RATIO` Default maximum eviction queue ratio.
`static CacheMemoryMode` `DFLT_MEMORY_MODE` Default memory mode.
`static int` `DFLT_NEAR_START_SIZE` Initial default near cache size.
`static long` `DFLT_OFFHEAP_MEMORY` Default off-heap storage size is `-1` which means that off-heap storage is disabled.
`static boolean` `DFLT_READ_FROM_BACKUP` Default value for 'readFromBackup' flag.
`static int` `DFLT_REBALANCE_BATCH_SIZE` Default rebalance batch size in bytes.
`static CacheRebalanceMode` `DFLT_REBALANCE_MODE` Default rebalance mode for distributed cache.
`static int` `DFLT_REBALANCE_THREAD_POOL_SIZE` Default size of rebalance thread pool.
`static long` `DFLT_REBALANCE_THROTTLE` Time in milliseconds to wait between rebalance messages to avoid overloading CPU.
`static long` `DFLT_REBALANCE_TIMEOUT` Default rebalance timeout (ms).
`static int` `DFLT_SQL_ONHEAP_ROW_CACHE_SIZE` Default size for onheap SQL row cache size.
`static int` `DFLT_START_SIZE` Initial default cache size.
`static boolean` `DFLT_SWAP_ENABLED` Default value for 'swapEnabled' flag.
`static int` `DFLT_WRITE_BEHIND_BATCH_SIZE` Default batch size for write-behind cache store.
`static int` `DFLT_WRITE_BEHIND_CRITICAL_SIZE` Default critical size used when flush size is not specified.
`static boolean` `DFLT_WRITE_BEHIND_ENABLED` Default value for 'writeBehindEnabled' flag.
`static long` `DFLT_WRITE_BEHIND_FLUSH_FREQUENCY` Default flush frequency for write-behind cache store in milliseconds.
`static int` `DFLT_WRITE_BEHIND_FLUSH_SIZE` Default flush size for write-behind cache store.
`static int` `DFLT_WRITE_FROM_BEHIND_FLUSH_THREAD_CNT` Default count of flush threads for write-behind cache store.
`static IgnitePredicate<ClusterNode>` `SERVER_NODES` Filter that accepts only server nodes.

### Fields inherited from class javax.cache.configuration.MutableConfiguration

`cacheLoaderFactory, cacheWriterFactory, expiryPolicyFactory, isManagementEnabled, isReadThrough, isStatisticsEnabled, isStoreByValue, isWriteThrough, keyType, listenerConfigurations, valueType`

### Constructor Summary

Constructors
Constructor and Description
`CacheConfiguration()` Empty constructor (all values are initialized to their defaults).
`CacheConfiguration(javax.cache.configuration.CompleteConfiguration<K,V> cfg)` Copy constructor.
`CacheConfiguration(String name)` Cache name.

### Method Summary

Methods
`AffinityFunction` `getAffinity()` Gets key topology resolver to provide mapping from keys to nodes.
`AffinityKeyMapper` `getAffinityMapper()` Affinity key mapper used to provide custom affinity key for any given key.
`CacheAtomicityMode` `getAtomicityMode()` Gets cache atomicity mode.
`CacheAtomicWriteOrderMode` `getAtomicWriteOrderMode()` Gets cache write ordering mode.
`int` `getBackups()` Gets number of nodes used to back up single partition for `CacheMode.PARTITIONED` cache.
`CacheMode` `getCacheMode()` Gets caching mode to use.
`javax.cache.configuration.Factory<CacheStore<? super K,? super V>>` `getCacheStoreFactory()` Gets factory for underlying persistent storage for read-through and write-through operations.
`long` `getDefaultLockTimeout()` Gets default lock acquisition timeout.
`EvictionFilter<K,V>` `getEvictionFilter()` Gets eviction filter to specify which entries should not be evicted (except explicit evict by calling `IgniteCache.localEvict(Collection)`).
`EvictionPolicy<K,V>` `getEvictionPolicy()` Gets cache eviction policy.
`float` `getEvictMaxOverflowRatio()` This value denotes the maximum size of eviction queue in percents of cache size in case of distributed cache (replicated and partitioned) and using synchronized eviction (that is if `isEvictSynchronized()` returns `true`).
`int` `getEvictSynchronizedConcurrencyLevel()` Gets concurrency level for synchronized evictions.
`int` `getEvictSynchronizedKeyBufferSize()` Gets size of the key buffer for synchronized evictions.
`long` `getEvictSynchronizedTimeout()` Gets timeout for synchronized evictions.
`Class<?>[]` `getIndexedTypes()` Array of key and value type pairs to be indexed (thus array length must be always even).
`CacheInterceptor<K,V>` `getInterceptor()` Gets cache interceptor.
`long` `getLongQueryWarningTimeout()` Gets timeout in milliseconds after which long query warning will be printed.
`int` `getMaxConcurrentAsyncOperations()` Gets maximum number of allowed concurrent asynchronous operations.
`CacheMemoryMode` `getMemoryMode()` Gets memory mode for cache.
`String` `getName()` Cache name or `null` if not provided, then this will be considered a default cache which can be accessed via `Ignite.cache(String)` method.
`NearCacheConfiguration<K,V>` `getNearConfiguration()`
`IgnitePredicate<ClusterNode>` `getNodeFilter()` Gets filter which determines on what nodes the cache should be started.
`long` `getOffHeapMaxMemory()` Gets maximum amount of memory available to off-heap storage.
`CachePluginConfiguration[]` `getPluginConfigurations()` Gets array of cache plugin configurations.
`int` `getRebalanceBatchSize()` Gets size (in number bytes) to be loaded within a single rebalance message.
`long` `getRebalanceDelay()` Gets delay in milliseconds upon a node joining or leaving topology (or crash) after which rebalancing should be started automatically.
`CacheRebalanceMode` `getRebalanceMode()` Gets rebalance mode for distributed cache.
`int` `getRebalanceOrder()` Gets cache rebalance order.
`int` `getRebalanceThreadPoolSize()` Gets size of rebalancing thread pool.
`long` `getRebalanceThrottle()` Time in milliseconds to wait between rebalance messages to avoid overloading of CPU or network.
`long` `getRebalanceTimeout()` Gets rebalance timeout (ms).
`Class<?>[]` `getSqlFunctionClasses()` Gets classes with methods annotated by `QuerySqlFunction` to be used as user-defined functions from SQL queries.
`int` `getSqlOnheapRowCacheSize()` Number of SQL rows which will be cached onheap to avoid deserialization on each SQL index access.
`int` `getStartSize()` Gets initial cache size which will be used to pre-create internal hash table after start.
`TopologyValidator` `getTopologyValidator()` Gets topology validator.
`String` `getTransactionManagerLookupClassName()` Gets class name of transaction manager finder for integration for JEE app servers.
`Collection<CacheTypeMetadata>` `getTypeMetadata()` Gets collection of type metadata objects.
`int` `getWriteBehindBatchSize()` Maximum batch size for write-behind cache store operations.
`long` `getWriteBehindFlushFrequency()` Frequency with which write-behind cache is flushed to the cache store in milliseconds.
`int` `getWriteBehindFlushSize()` Maximum size of the write-behind cache.
`int` `getWriteBehindFlushThreadCount()` Number of threads that will perform cache flushing.
`CacheWriteSynchronizationMode` `getWriteSynchronizationMode()` Gets write synchronization mode.
`boolean` `isCopyOnRead()` Gets flag indicating whether copy of of the value stored in cache should be created for cache operation implying return value.
`boolean` `isEagerTtl()` Gets flag indicating whether expired cache entries will be eagerly removed from cache.
`boolean` `isEvictSynchronized()` Gets flag indicating whether eviction is synchronized between primary, backup and near nodes.
`boolean` `isInvalidate()` Invalidation flag.

`boolean`

`isLoadPreviousValue()`
Gets flag indicating whether value should be loaded from store if it is not in the cache for following cache operations: `IgniteCache.putIfAbsent(Object, Object)` `IgniteCache.replace(Object, Object)` `IgniteCache.replace(Object, Object, Object)` `IgniteCache.remove(Object, Object)` `IgniteCache.getAndPut(Object, Object)` `IgniteCache.getAndRemove(Object)` `IgniteCache.getAndReplace(Object, Object)` `IgniteCache.getAndPutIfAbsent(Object, Object)`

`boolean` `isReadFromBackup()` Gets flag indicating whether data can be read from backup.
`boolean` `isSqlEscapeAll()` If `true` all the SQL table and field names will be escaped with double quotes like ({@code "tableName"."
`boolean` `isSwapEnabled()` Flag indicating whether Ignite should use swap storage by default.
`boolean` `isWriteBehindEnabled()` Flag indicating whether Ignite should use write-behind behaviour for the cache store.
`CacheConfiguration` `setAffinity(AffinityFunction aff)` Sets affinity for cache keys.
`CacheConfiguration` `setAffinityMapper(AffinityKeyMapper affMapper)` Sets custom affinity mapper.
`CacheConfiguration` `setAtomicityMode(CacheAtomicityMode atomicityMode)` Sets cache atomicity mode.
`CacheConfiguration` `setAtomicWriteOrderMode(CacheAtomicWriteOrderMode atomicWriteOrderMode)` Sets cache write ordering mode.
`CacheConfiguration` `setBackups(int backups)` Sets number of nodes used to back up single partition for `CacheMode.PARTITIONED` cache.
`CacheConfiguration` `setCacheMode(CacheMode cacheMode)` Sets caching mode.
`CacheConfiguration` `setCacheStoreFactory(javax.cache.configuration.Factory<? extends CacheStore<? super K,? super V>> storeFactory)` Sets factory fpr persistent storage for cache data.
`CacheConfiguration` `setCopyOnRead(boolean cpOnRead)` Sets copy on read flag.
`CacheConfiguration` `setDefaultLockTimeout(long dfltLockTimeout)` Sets default lock timeout in milliseconds.
`CacheConfiguration` `setEagerTtl(boolean eagerTtl)` Sets eager ttl flag.
`CacheConfiguration` `setEvictionFilter(EvictionFilter<K,V> evictFilter)` Sets eviction filter.
`CacheConfiguration` `setEvictionPolicy(EvictionPolicy evictPlc)` Sets cache eviction policy.
`CacheConfiguration` `setEvictMaxOverflowRatio(float evictMaxOverflowRatio)` Sets maximum eviction overflow ratio.
`CacheConfiguration` `setEvictSynchronized(boolean evictSync)` Sets flag indicating whether eviction is synchronized with backup nodes or near caches (or the rest of the nodes for replicated cache).
`CacheConfiguration` `setEvictSynchronizedConcurrencyLevel(int evictSyncConcurrencyLvl)` Sets concurrency level for synchronized evictions.
`CacheConfiguration` `setEvictSynchronizedKeyBufferSize(int evictKeyBufSize)` Sets eviction key buffer size.
`CacheConfiguration` `setEvictSynchronizedTimeout(long evictSyncTimeout)` Sets timeout for synchronized evictions.
`CacheConfiguration` `setIndexedTypes(Class<?>... indexedTypes)` Array of key and value type pairs to be indexed (thus array length must be always even).
`CacheConfiguration` `setInterceptor(CacheInterceptor<K,V> interceptor)` Sets cache interceptor.
`CacheConfiguration` `setInvalidate(boolean invalidate)` Sets invalidation flag for near cache entries in this transaction.

`CacheConfiguration`

`setLoadPreviousValue(boolean loadPrevVal)`
Sets flag indicating whether value should be loaded from store if it is not in the cache for following cache operations: `IgniteCache.putIfAbsent(Object, Object)` `IgniteCache.replace(Object, Object)` `IgniteCache.replace(Object, Object, Object)` `IgniteCache.remove(Object, Object)` `IgniteCache.getAndPut(Object, Object)` `IgniteCache.getAndRemove(Object)` `IgniteCache.getAndReplace(Object, Object)` `IgniteCache.getAndPutIfAbsent(Object, Object)` When not set, default value is `DFLT_LOAD_PREV_VAL`.

`CacheConfiguration` `setLongQueryWarningTimeout(long longQryWarnTimeout)` Gets timeout in milliseconds after which long query warning will be printed.
`CacheConfiguration` `setMaxConcurrentAsyncOperations(int maxConcurrentAsyncOps)` Sets maximum number of concurrent asynchronous operations.
`CacheConfiguration` `setMemoryMode(CacheMemoryMode memMode)` Sets memory mode for cache.
`CacheConfiguration` `setName(String name)` Sets cache name.
`CacheConfiguration` `setNearConfiguration(NearCacheConfiguration<K,V> nearCfg)`
`CacheConfiguration` `setNodeFilter(IgnitePredicate<ClusterNode> nodeFilter)` Sets filter which determines on what nodes the cache should be started.
`CacheConfiguration` `setOffHeapMaxMemory(long offHeapMaxMem)` Sets maximum amount of memory available to off-heap storage.
`CacheConfiguration` `setPluginConfigurations(CachePluginConfiguration... pluginCfgs)` Sets cache plugin configurations.
`CacheConfiguration` `setReadFromBackup(boolean readFromBackup)` Sets read from backup flag.
`CacheConfiguration` `setRebalanceBatchSize(int rebalanceBatchSize)` Sets rebalance batch size.
`CacheConfiguration` `setRebalanceDelay(long rebalanceDelay)` Sets rebalance delay (see `getRebalanceDelay()` for more information).
`CacheConfiguration` `setRebalanceMode(CacheRebalanceMode rebalanceMode)` Sets cache rebalance mode.
`CacheConfiguration` `setRebalanceOrder(int rebalanceOrder)` Sets cache rebalance order.
`CacheConfiguration` `setRebalanceThreadPoolSize(int rebalancePoolSize)` Sets size of rebalancing thread pool.
`CacheConfiguration` `setRebalanceThrottle(long rebalanceThrottle)` Time in milliseconds to wait between rebalance messages to avoid overloading of CPU or network.
`CacheConfiguration` `setRebalanceTimeout(long rebalanceTimeout)` Sets rebalance timeout (ms).
`CacheConfiguration` `setSqlEscapeAll(boolean sqlEscapeAll)` If `true` all the SQL table and field names will be escaped with double quotes like ({@code "tableName"."
`CacheConfiguration` `setSqlFunctionClasses(Class<?>... cls)` Sets classes with methods annotated by `QuerySqlFunction` to be used as user-defined functions from SQL queries.
`CacheConfiguration` `setSqlOnheapRowCacheSize(int size)` Number of SQL rows which will be cached onheap to avoid deserialization on each SQL index access.
`CacheConfiguration` `setStartSize(int startSize)` Initial size for internal hash map.
`CacheConfiguration` `setSwapEnabled(boolean swapEnabled)` Flag indicating whether swap storage is enabled or not.
`CacheConfiguration` `setTopologyValidator(TopologyValidator topValidator)` Sets topology validator.
`CacheConfiguration` `setTransactionManagerLookupClassName(String tmLookupClsName)` Sets look up mechanism for available `TransactionManager` implementation, if any.
`CacheConfiguration` `setTypeMetadata(Collection<CacheTypeMetadata> typeMeta)` Sets collection of type metadata objects.
`CacheConfiguration` `setWriteBehindBatchSize(int writeBehindBatchSize)` Sets maximum batch size for write-behind cache.
`CacheConfiguration` `setWriteBehindEnabled(boolean writeBehindEnabled)` Sets flag indicating whether write-behind is enabled.
`CacheConfiguration` `setWriteBehindFlushFrequency(long writeBehindFlushFreq)` Sets write-behind flush frequency.
`CacheConfiguration` `setWriteBehindFlushSize(int writeBehindFlushSize)` Sets write-behind flush size.
`CacheConfiguration` `setWriteBehindFlushThreadCount(int writeBehindFlushThreadCnt)` Sets flush thread count for write-behind cache.
`CacheConfiguration` `setWriteSynchronizationMode(CacheWriteSynchronizationMode writeSync)` Sets write synchronization mode.
`String` `toString()`

### Methods inherited from class javax.cache.configuration.MutableConfiguration

`addCacheEntryListenerConfiguration, equals, getCacheEntryListenerConfigurations, getCacheLoaderFactory, getCacheWriterFactory, getExpiryPolicyFactory, getKeyType, getValueType, hashCode, isManagementEnabled, isReadThrough, isStatisticsEnabled, isStoreByValue, isWriteThrough, removeCacheEntryListenerConfiguration, setCacheLoaderFactory, setCacheWriterFactory, setExpiryPolicyFactory, setManagementEnabled, setReadThrough, setStatisticsEnabled, setStoreByValue, setTypes, setWriteThrough`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Field Detail

#### DFLT_REBALANCE_THREAD_POOL_SIZE

    public static final int DFLT_REBALANCE_THREAD_POOL_SIZE

Default size of rebalance thread pool.

See Also:
  Constant Field Values

#### DFLT_REBALANCE_TIMEOUT

    public static final long DFLT_REBALANCE_TIMEOUT

Default rebalance timeout (ms).

See Also:
  Constant Field Values

#### DFLT_REBALANCE_THROTTLE

    public static final long DFLT_REBALANCE_THROTTLE

Time in milliseconds to wait between rebalance messages to avoid overloading CPU.

See Also:
  Constant Field Values

#### DFLT_BACKUPS

    public static final int DFLT_BACKUPS

Default number of backups.

See Also:
  Constant Field Values

#### DFLT_CACHE_MODE

    public static final CacheMode DFLT_CACHE_MODE

Default caching mode.

#### DFLT_CACHE_ATOMICITY_MODE

    public static final CacheAtomicityMode DFLT_CACHE_ATOMICITY_MODE

Default atomicity mode.

#### DFLT_LOCK_TIMEOUT

    public static final long DFLT_LOCK_TIMEOUT

Default lock timeout.

See Also:
  Constant Field Values

#### DFLT_START_SIZE

    public static final int DFLT_START_SIZE

Initial default cache size.

See Also:
  Constant Field Values

#### DFLT_CACHE_SIZE

    public static final int DFLT_CACHE_SIZE

Default cache size to use with eviction policy.

See Also:
  Constant Field Values

#### DFLT_NEAR_START_SIZE

    public static final int DFLT_NEAR_START_SIZE

Initial default near cache size.

See Also:
  Constant Field Values

#### DFLT_INVALIDATE

    public static final boolean DFLT_INVALIDATE

Default value for 'invalidate' flag that indicates if this is invalidation-based cache.

See Also:
  Constant Field Values

#### DFLT_REBALANCE_MODE

    public static final CacheRebalanceMode DFLT_REBALANCE_MODE

Default rebalance mode for distributed cache.

#### DFLT_REBALANCE_BATCH_SIZE

    public static final int DFLT_REBALANCE_BATCH_SIZE

Default rebalance batch size in bytes.

See Also:
  Constant Field Values

#### DFLT_MAX_EVICTION_OVERFLOW_RATIO

    public static final float DFLT_MAX_EVICTION_OVERFLOW_RATIO

Default maximum eviction queue ratio.

See Also:
  Constant Field Values

#### DFLT_EVICT_SYNCHRONIZED

    public static final boolean DFLT_EVICT_SYNCHRONIZED

Default eviction synchronized flag.

See Also:
  Constant Field Values

#### DFLT_EVICT_KEY_BUFFER_SIZE

    public static final int DFLT_EVICT_KEY_BUFFER_SIZE

Default eviction key buffer size for batching synchronized evicts.

See Also:
  Constant Field Values

#### DFLT_EVICT_SYNCHRONIZED_TIMEOUT

    public static final long DFLT_EVICT_SYNCHRONIZED_TIMEOUT

Default synchronous eviction timeout in milliseconds.

See Also:
  Constant Field Values

#### DFLT_EVICT_SYNCHRONIZED_CONCURRENCY_LEVEL

    public static final int DFLT_EVICT_SYNCHRONIZED_CONCURRENCY_LEVEL

Default synchronous eviction concurrency level.

See Also:
  Constant Field Values

#### DFLT_EAGER_TTL

    public static final boolean DFLT_EAGER_TTL

Default value for eager ttl flag.

See Also:
  Constant Field Values

#### DFLT_OFFHEAP_MEMORY

    public static final long DFLT_OFFHEAP_MEMORY

Default off-heap storage size is `-1` which means that off-heap storage is disabled.

See Also:
  Constant Field Values

#### DFLT_SWAP_ENABLED

    public static final boolean DFLT_SWAP_ENABLED

Default value for 'swapEnabled' flag.

See Also:
  Constant Field Values

#### DFLT_MAX_CONCURRENT_ASYNC_OPS

    public static final int DFLT_MAX_CONCURRENT_ASYNC_OPS

Default value for 'maxConcurrentAsyncOps'.

See Also:
  Constant Field Values

#### DFLT_WRITE_BEHIND_ENABLED

    public static final boolean DFLT_WRITE_BEHIND_ENABLED

Default value for 'writeBehindEnabled' flag.

See Also:
  Constant Field Values

#### DFLT_WRITE_BEHIND_FLUSH_SIZE

    public static final int DFLT_WRITE_BEHIND_FLUSH_SIZE

Default flush size for write-behind cache store.

See Also:
  Constant Field Values

#### DFLT_WRITE_BEHIND_CRITICAL_SIZE

    public static final int DFLT_WRITE_BEHIND_CRITICAL_SIZE

Default critical size used when flush size is not specified.

See Also:
  Constant Field Values

#### DFLT_WRITE_BEHIND_FLUSH_FREQUENCY

    public static final long DFLT_WRITE_BEHIND_FLUSH_FREQUENCY

Default flush frequency for write-behind cache store in milliseconds.

See Also:
  Constant Field Values

#### DFLT_WRITE_FROM_BEHIND_FLUSH_THREAD_CNT

    public static final int DFLT_WRITE_FROM_BEHIND_FLUSH_THREAD_CNT

Default count of flush threads for write-behind cache store.

See Also:
  Constant Field Values

#### DFLT_WRITE_BEHIND_BATCH_SIZE

    public static final int DFLT_WRITE_BEHIND_BATCH_SIZE

Default batch size for write-behind cache store.

See Also:
  Constant Field Values

#### DFLT_LOAD_PREV_VAL

    public static final boolean DFLT_LOAD_PREV_VAL

Default value for load previous value flag.

See Also:
  Constant Field Values

#### DFLT_MEMORY_MODE

    public static final CacheMemoryMode DFLT_MEMORY_MODE

Default memory mode.

#### DFLT_READ_FROM_BACKUP

    public static final boolean DFLT_READ_FROM_BACKUP

Default value for 'readFromBackup' flag.

See Also:
  Constant Field Values

#### SERVER_NODES

    public static final IgnitePredicate<ClusterNode> SERVER_NODES

Filter that accepts only server nodes.

#### ALL_NODES

    public static final IgnitePredicate<ClusterNode> ALL_NODES

Filter that accepts all nodes.

#### DFLT_LONG_QRY_WARN_TIMEOUT

    public static final long DFLT_LONG_QRY_WARN_TIMEOUT

Default timeout after which long query warning will be printed.

See Also:
  Constant Field Values

#### DFLT_SQL_ONHEAP_ROW_CACHE_SIZE

    public static final int DFLT_SQL_ONHEAP_ROW_CACHE_SIZE

Default size for onheap SQL row cache size.

See Also:
  Constant Field Values

#### DFLT_COPY_ON_READ

    public static final boolean DFLT_COPY_ON_READ

Default value for 'copyOnRead' flag.

See Also:
  Constant Field Values

### Constructor Detail

#### CacheConfiguration

    public CacheConfiguration()

Empty constructor (all values are initialized to their defaults).

#### CacheConfiguration

    public CacheConfiguration(String name)

Cache name.

#### CacheConfiguration

    public CacheConfiguration(javax.cache.configuration.CompleteConfiguration<K,V> cfg)

Copy constructor.

Parameters:
  `cfg` - Configuration to copy.

### Method Detail

#### getName

    public String getName()

Cache name or `null` if not provided, then this will be considered a default cache which can be accessed via `Ignite.cache(String)` method. Otherwise, if name is provided, the cache will be accessed via `Ignite.cache(String)` method.

Returns:
  Cache name.

#### setName

    public CacheConfiguration setName(String name)

Sets cache name.

Parameters:
  `name` - Cache name. May be `null`, but may not be empty string.
Returns:
  `this` for chaining.

#### getEvictionPolicy

    @Nullable
    public EvictionPolicy<K,V> getEvictionPolicy()

Gets cache eviction policy. By default, returns `null` which means that evictions are disabled for cache.

Returns:
  Cache eviction policy or `null` if evictions should be disabled.

#### setEvictionPolicy

    public CacheConfiguration setEvictionPolicy(@Nullable
                                       EvictionPolicy evictPlc)

Sets cache eviction policy.

Parameters:
  `evictPlc` - Cache expiration policy.
Returns:
  `this` for chaining.

#### getNearConfiguration

    public NearCacheConfiguration<K,V> getNearConfiguration()

Returns:
  Near enabled flag.

#### setNearConfiguration

    public CacheConfiguration setNearConfiguration(NearCacheConfiguration<K,V> nearCfg)

Parameters:
  `nearCfg` - Near cache configuration.
Returns:
  `this` for chaining.

#### getWriteSynchronizationMode

    public CacheWriteSynchronizationMode getWriteSynchronizationMode()

Gets write synchronization mode. This mode controls whether the main caller should wait for update on other nodes to complete or not.

Returns:
  Write synchronization mode.

#### setWriteSynchronizationMode

    public CacheConfiguration setWriteSynchronizationMode(CacheWriteSynchronizationMode writeSync)

Sets write synchronization mode.

Parameters:
  `writeSync` - Write synchronization mode.
Returns:
  `this` for chaining.

#### getNodeFilter

    public IgnitePredicate<ClusterNode> getNodeFilter()

Gets filter which determines on what nodes the cache should be started.

Returns:
  Predicate specifying on which nodes the cache should be started.

#### setNodeFilter

    public CacheConfiguration setNodeFilter(IgnitePredicate<ClusterNode> nodeFilter)

Sets filter which determines on what nodes the cache should be started.

Parameters:
  `nodeFilter` - Predicate specifying on which nodes the cache should be started.
Returns:
  `this` for chaining.

#### isEvictSynchronized

    public boolean isEvictSynchronized()

Gets flag indicating whether eviction is synchronized between primary, backup and near nodes. If this parameter is `true` and swap is disabled then `IgniteCache.localEvict(Collection)` will involve all nodes where an entry is kept. If this property is set to `false` then eviction is done independently on different cache nodes.

Default value is defined by `DFLT_EVICT_SYNCHRONIZED`.

Note that it's not recommended to set this value to `true` if cache store is configured since it will allow to significantly improve cache performance.

Returns:
  `true` If eviction is synchronized with backup nodes (or the rest of the nodes in case of replicated cache), `false` if not.

#### setEvictSynchronized

    public CacheConfiguration setEvictSynchronized(boolean evictSync)

Sets flag indicating whether eviction is synchronized with backup nodes or near caches (or the rest of the nodes for replicated cache).

Parameters:
  `evictSync` - `true` if synchronized, `false` if not.
Returns:
  `this` for chaining.

#### getEvictSynchronizedKeyBufferSize

    public int getEvictSynchronizedKeyBufferSize()

Gets size of the key buffer for synchronized evictions.

Default value is defined by `DFLT_EVICT_KEY_BUFFER_SIZE`.

Returns:
  Eviction key buffer size.

#### setEvictSynchronizedKeyBufferSize

    public CacheConfiguration setEvictSynchronizedKeyBufferSize(int evictKeyBufSize)

Sets eviction key buffer size.

Parameters:
  `evictKeyBufSize` - Eviction key buffer size.
Returns:
  `this` for chaining.

#### getEvictSynchronizedConcurrencyLevel

    public int getEvictSynchronizedConcurrencyLevel()

Gets concurrency level for synchronized evictions. This flag only makes sense with `isEvictSynchronized()` set to `true`. When synchronized evictions are enabled, it is possible that local eviction policy will try to evict entries faster than evictions can be synchronized with backup or near nodes. This value specifies how many concurrent synchronous eviction sessions should be allowed before the system is forced to wait and let synchronous evictions catch up with the eviction policy.

Note that if synchronous evictions start lagging, it is possible that you have either too big or too small eviction key buffer size or small eviction timeout. In that case you will need to adjust `getEvictSynchronizedKeyBufferSize()` or `getEvictSynchronizedTimeout()` values as well.

Default value is defined by `DFLT_EVICT_SYNCHRONIZED_CONCURRENCY_LEVEL`.

Returns:
  Synchronous eviction concurrency level.

#### setEvictSynchronizedConcurrencyLevel

    public CacheConfiguration setEvictSynchronizedConcurrencyLevel(int evictSyncConcurrencyLvl)

Sets concurrency level for synchronized evictions.

Parameters:
  `evictSyncConcurrencyLvl` - Concurrency level for synchronized evictions.
Returns:
  `this` for chaining.

#### getEvictSynchronizedTimeout

    public long getEvictSynchronizedTimeout()

Gets timeout for synchronized evictions.

Node that initiates eviction waits for responses from remote nodes within this timeout.

Default value is defined by `DFLT_EVICT_SYNCHRONIZED_TIMEOUT`.

Returns:
  Synchronous eviction timeout.

#### setEvictSynchronizedTimeout

    public CacheConfiguration setEvictSynchronizedTimeout(long evictSyncTimeout)

Sets timeout for synchronized evictions.

Parameters:
  `evictSyncTimeout` - Timeout for synchronized evictions.
Returns:
  `this` for chaining.

#### getEvictMaxOverflowRatio

    public float getEvictMaxOverflowRatio()

This value denotes the maximum size of eviction queue in percents of cache size in case of distributed cache (replicated and partitioned) and using synchronized eviction (that is if `isEvictSynchronized()` returns `true`).

That queue is used internally as a buffer to decrease network costs for synchronized eviction. Once queue size reaches specified value all required requests for all entries in the queue are sent to remote nodes and the queue is cleared.

Default value is defined by `DFLT_MAX_EVICTION_OVERFLOW_RATIO` and equals to `10%`.

Returns:
  Maximum size of eviction queue in percents of cache size.

#### setEvictMaxOverflowRatio

    public CacheConfiguration setEvictMaxOverflowRatio(float evictMaxOverflowRatio)

Sets maximum eviction overflow ratio.

Parameters:
  `evictMaxOverflowRatio` - Maximum eviction overflow ratio.
Returns:
  `this` for chaining.

#### getEvictionFilter

    public EvictionFilter<K,V> getEvictionFilter()

Gets eviction filter to specify which entries should not be evicted (except explicit evict by calling `IgniteCache.localEvict(Collection)`). If `EvictionFilter.evictAllowed(Cache.Entry)` method returns `false` then eviction policy will not be notified and entry will never be evicted.

If not provided, any entry may be evicted depending on `eviction policy` configuration.

Returns:
  Eviction filter or `null`.

#### setEvictionFilter

    public CacheConfiguration setEvictionFilter(EvictionFilter<K,V> evictFilter)

Sets eviction filter.

Parameters:
  `evictFilter` - Eviction filter.
Returns:
  `this` for chaining.

#### isEagerTtl

    public boolean isEagerTtl()

Gets flag indicating whether expired cache entries will be eagerly removed from cache. When set to `false`, expired entries will be removed on next entry access.

When not set, default value is `DFLT_EAGER_TTL`.

Note that this flag only matters for entries expiring based on `ExpiryPolicy` and should not be confused with entry evictions based on configured `EvictionPolicy`.

Returns:
  Flag indicating whether Ignite will eagerly remove expired entries.

#### setEagerTtl

    public CacheConfiguration setEagerTtl(boolean eagerTtl)

Sets eager ttl flag.

Parameters:
  `eagerTtl` - `True` if Ignite should eagerly remove expired cache entries.
Returns:
  `this` for chaining.
See Also:
  `isEagerTtl()`

#### getStartSize

    public int getStartSize()

Gets initial cache size which will be used to pre-create internal hash table after start. Default value is defined by `DFLT_START_SIZE`.

Returns:
  Initial cache size.

#### setStartSize

    public CacheConfiguration setStartSize(int startSize)

Initial size for internal hash map.

Parameters:
  `startSize` - Cache start size.
Returns:
  `this` for chaining.

#### isLoadPreviousValue

    public boolean isLoadPreviousValue()

Gets flag indicating whether value should be loaded from store if it is not in the cache for following cache operations:

- `IgniteCache.putIfAbsent(Object, Object)`
- `IgniteCache.replace(Object, Object)`
- `IgniteCache.replace(Object, Object, Object)`
- `IgniteCache.remove(Object, Object)`
- `IgniteCache.getAndPut(Object, Object)`
- `IgniteCache.getAndRemove(Object)`
- `IgniteCache.getAndReplace(Object, Object)`
- `IgniteCache.getAndPutIfAbsent(Object, Object)`

Returns:
  Load previous value flag.

#### setLoadPreviousValue

    public CacheConfiguration setLoadPreviousValue(boolean loadPrevVal)

Sets flag indicating whether value should be loaded from store if it is not in the cache for following cache operations:

- `IgniteCache.putIfAbsent(Object, Object)`
- `IgniteCache.replace(Object, Object)`
- `IgniteCache.replace(Object, Object, Object)`
- `IgniteCache.remove(Object, Object)`
- `IgniteCache.getAndPut(Object, Object)`
- `IgniteCache.getAndRemove(Object)`
- `IgniteCache.getAndReplace(Object, Object)`
- `IgniteCache.getAndPutIfAbsent(Object, Object)`

When not set, default value is `DFLT_LOAD_PREV_VAL`.

Parameters:
  `loadPrevVal` - Load previous value flag.
Returns:
  `this` for chaining.

#### getCacheStoreFactory

    public javax.cache.configuration.Factory<CacheStore<? super K,? super V>> getCacheStoreFactory()

Gets factory for underlying persistent storage for read-through and write-through operations.

Returns:
  Cache store factory.

#### setCacheStoreFactory

    public CacheConfiguration setCacheStoreFactory(javax.cache.configuration.Factory<? extends CacheStore<? super K,? super V>> storeFactory)

Sets factory fpr persistent storage for cache data.

Parameters:
  `storeFactory` - Cache store factory.

#### getAffinity

    public AffinityFunction getAffinity()

Gets key topology resolver to provide mapping from keys to nodes.

Returns:
  Key topology resolver to provide mapping from keys to nodes.

#### setAffinity

    public CacheConfiguration setAffinity(AffinityFunction aff)

Sets affinity for cache keys.

Parameters:
  `aff` - Cache key affinity.
Returns:
  `this` for chaining.

#### getCacheMode

    public CacheMode getCacheMode()

Gets caching mode to use. You can configure cache either to be local-only, fully replicated, partitioned, or near. If not provided, `CacheMode.REPLICATED` mode will be used by default (defined by `DFLT_CACHE_MODE` constant).

Returns:
  `True` if cache is local.

#### setCacheMode

    public CacheConfiguration setCacheMode(CacheMode cacheMode)

Sets caching mode.

Parameters:
  `cacheMode` - Caching mode.
Returns:
  `this` for chaining.

#### getAtomicityMode

    public CacheAtomicityMode getAtomicityMode()

Gets cache atomicity mode.

Default value is defined by `DFLT_CACHE_ATOMICITY_MODE`.

Returns:
  Cache atomicity mode.

#### setAtomicityMode

    public CacheConfiguration setAtomicityMode(CacheAtomicityMode atomicityMode)

Sets cache atomicity mode.

Parameters:
  `atomicityMode` - Cache atomicity mode.
Returns:
  `this` for chaining.

#### getAtomicWriteOrderMode

    public CacheAtomicWriteOrderMode getAtomicWriteOrderMode()

Gets cache write ordering mode. This property can be enabled only for `CacheAtomicityMode.ATOMIC` cache (for other atomicity modes it will be ignored).

Returns:
  Cache write ordering mode.

#### setAtomicWriteOrderMode

    public CacheConfiguration setAtomicWriteOrderMode(CacheAtomicWriteOrderMode atomicWriteOrderMode)

Sets cache write ordering mode. This property can be enabled only for `CacheAtomicityMode.ATOMIC` cache (for other atomicity modes it will be ignored).

Parameters:
  `atomicWriteOrderMode` - Cache write ordering mode.
Returns:
  `this` for chaining.

#### getBackups

    public int getBackups()

Gets number of nodes used to back up single partition for `CacheMode.PARTITIONED` cache.

If not set, default value is `DFLT_BACKUPS`.

Returns:
  Number of backup nodes for one partition.

#### setBackups

    public CacheConfiguration setBackups(int backups)

Sets number of nodes used to back up single partition for `CacheMode.PARTITIONED` cache.

If not set, default value is `DFLT_BACKUPS`.

Parameters:
  `backups` - Number of backup nodes for one partition.
Returns:
  `this` for chaining.

#### getDefaultLockTimeout

    public long getDefaultLockTimeout()

Gets default lock acquisition timeout. Default value is defined by `DFLT_LOCK_TIMEOUT` which is `0` and means that lock acquisition will never timeout.

Returns:
  Default lock timeout.

#### setDefaultLockTimeout

    public CacheConfiguration setDefaultLockTimeout(long dfltLockTimeout)

Sets default lock timeout in milliseconds. By default this value is defined by `DFLT_LOCK_TIMEOUT`.

Parameters:
  `dfltLockTimeout` - Default lock timeout.
Returns:
  `this` for chaining.

#### isInvalidate

    public boolean isInvalidate()

Invalidation flag. If `true`, values will be invalidated (nullified) upon commit in near cache.

Returns:
  Invalidation flag.

#### setInvalidate

    public CacheConfiguration setInvalidate(boolean invalidate)

Sets invalidation flag for near cache entries in this transaction. Default is `false`.

Parameters:
  `invalidate` - Flag to set this cache into invalidation-based mode. Default value is `false`.
Returns:
  `this` for chaining.

#### getTransactionManagerLookupClassName

    public String getTransactionManagerLookupClassName()

Gets class name of transaction manager finder for integration for JEE app servers.

Returns:
  Transaction manager finder.

#### setTransactionManagerLookupClassName

    public CacheConfiguration setTransactionManagerLookupClassName(String tmLookupClsName)

Sets look up mechanism for available `TransactionManager` implementation, if any.

Parameters:
  `tmLookupClsName` - Name of class implementing GridCacheTmLookup interface that is used to receive JTA transaction manager.
Returns:
  `this` for chaining.

#### setRebalanceMode

    public CacheConfiguration setRebalanceMode(CacheRebalanceMode rebalanceMode)

Sets cache rebalance mode.

Parameters:
  `rebalanceMode` - Rebalance mode.
Returns:
  `this` for chaining.

#### getRebalanceMode

    public CacheRebalanceMode getRebalanceMode()

Gets rebalance mode for distributed cache.

Default is defined by `DFLT_REBALANCE_MODE`.

Returns:
  Rebalance mode.

#### getRebalanceOrder

    public int getRebalanceOrder()

Gets cache rebalance order. Rebalance order can be set to non-zero value for caches with `SYNC` or `ASYNC` rebalance modes only.

If cache rebalance order is positive, rebalancing for this cache will be started only when rebalancing for all caches with smaller rebalance order (except caches with rebalance order `0`) will be completed.

Note that cache with order `0` does not participate in ordering. This means that cache with rebalance order `1` will never wait for any other caches. All caches with order `0` will be rebalanced right away concurrently with each other and ordered rebalance processes.

If not set, cache order is 0, i.e. rebalancing is not ordered.

Returns:
  Cache rebalance order.

#### setRebalanceOrder

    public CacheConfiguration setRebalanceOrder(int rebalanceOrder)

Sets cache rebalance order.

Parameters:
  `rebalanceOrder` - Cache rebalance order.
Returns:
  `this` for chaining.
See Also:
  `getRebalanceOrder()`

#### getRebalanceBatchSize

    public int getRebalanceBatchSize()

Gets size (in number bytes) to be loaded within a single rebalance message. Rebalancing algorithm will split total data set on every node into multiple batches prior to sending data. Default value is defined by `DFLT_REBALANCE_BATCH_SIZE`.

Returns:
  Size in bytes of a single rebalance message.

#### setRebalanceBatchSize

    public CacheConfiguration setRebalanceBatchSize(int rebalanceBatchSize)

Sets rebalance batch size.

Parameters:
  `rebalanceBatchSize` - Rebalance batch size.
Returns:
  `this` for chaining.

#### isSwapEnabled

    public boolean isSwapEnabled()

Flag indicating whether Ignite should use swap storage by default. By default swap is disabled which is defined via `DFLT_SWAP_ENABLED` constant.

Returns:
  `True` if swap storage is enabled.

#### setSwapEnabled

    public CacheConfiguration setSwapEnabled(boolean swapEnabled)

Flag indicating whether swap storage is enabled or not.

Parameters:
  `swapEnabled` - `True` if swap storage is enabled.
Returns:
  `this` for chaining.

#### getMaxConcurrentAsyncOperations

    public int getMaxConcurrentAsyncOperations()

Gets maximum number of allowed concurrent asynchronous operations. If 0 returned then number of concurrent asynchronous operations is unlimited.

If not set, default value is `DFLT_MAX_CONCURRENT_ASYNC_OPS`.

If user threads do not wait for asynchronous operations to complete, it is possible to overload a system. This property enables back-pressure control by limiting number of scheduled asynchronous cache operations.

Returns:
  Maximum number of concurrent asynchronous operations or `0` if unlimited.

#### setMaxConcurrentAsyncOperations

    public CacheConfiguration setMaxConcurrentAsyncOperations(int maxConcurrentAsyncOps)

Sets maximum number of concurrent asynchronous operations.

Parameters:
  `maxConcurrentAsyncOps` - Maximum number of concurrent asynchronous operations.
Returns:
  `this` for chaining.
See Also:
  `getMaxConcurrentAsyncOperations()`

#### isWriteBehindEnabled

    public boolean isWriteBehindEnabled()

Flag indicating whether Ignite should use write-behind behaviour for the cache store. By default write-behind is disabled which is defined via `DFLT_WRITE_BEHIND_ENABLED` constant.

Returns:
  `True` if write-behind is enabled.

#### setWriteBehindEnabled

    public CacheConfiguration setWriteBehindEnabled(boolean writeBehindEnabled)

Sets flag indicating whether write-behind is enabled.

Parameters:
  `writeBehindEnabled` - `true` if write-behind is enabled.
Returns:
  `this` for chaining.

#### getWriteBehindFlushSize

    public int getWriteBehindFlushSize()

Maximum size of the write-behind cache. If cache size exceeds this value, all cached items are flushed to the cache store and write cache is cleared.

If not provided, default value is `DFLT_WRITE_BEHIND_FLUSH_SIZE`. If this value is `0`, then flush is performed according to the flush frequency interval.

Note that you cannot set both, `flush` size and `flush frequency`, to `0`.

Returns:
  Maximum object count in write-behind cache.

#### setWriteBehindFlushSize

    public CacheConfiguration setWriteBehindFlushSize(int writeBehindFlushSize)

Sets write-behind flush size.

Parameters:
  `writeBehindFlushSize` - Write-behind cache flush size.
Returns:
  `this` for chaining.
See Also:
  `getWriteBehindFlushSize()`

#### getWriteBehindFlushFrequency

    public long getWriteBehindFlushFrequency()

Frequency with which write-behind cache is flushed to the cache store in milliseconds. This value defines the maximum time interval between object insertion/deletion from the cache ant the moment when corresponding operation is applied to the cache store.

If not provided, default value is `DFLT_WRITE_BEHIND_FLUSH_FREQUENCY`. If this value is `0`, then flush is performed according to the flush size.

Note that you cannot set both, `flush` size and `flush frequency`, to `0`.

Returns:
  Write-behind flush frequency in milliseconds.

#### setWriteBehindFlushFrequency

    public CacheConfiguration setWriteBehindFlushFrequency(long writeBehindFlushFreq)

Sets write-behind flush frequency.

Parameters:
  `writeBehindFlushFreq` - Write-behind flush frequency in milliseconds.
Returns:
  `this` for chaining.
See Also:
  `getWriteBehindFlushFrequency()`

#### getWriteBehindFlushThreadCount

    public int getWriteBehindFlushThreadCount()

Number of threads that will perform cache flushing. Cache flushing is performed when cache size exceeds value defined by `getWriteBehindFlushSize()`, or flush interval defined by `getWriteBehindFlushFrequency()` is elapsed.

If not provided, default value is `DFLT_WRITE_FROM_BEHIND_FLUSH_THREAD_CNT`.

Returns:
  Count of flush threads.

#### setWriteBehindFlushThreadCount

    public CacheConfiguration setWriteBehindFlushThreadCount(int writeBehindFlushThreadCnt)

Sets flush thread count for write-behind cache.

Parameters:
  `writeBehindFlushThreadCnt` - Count of flush threads.
Returns:
  `this` for chaining.
See Also:
  `getWriteBehindFlushThreadCount()`

#### getWriteBehindBatchSize

    public int getWriteBehindBatchSize()

Maximum batch size for write-behind cache store operations. Store operations (get or remove) are combined in a batch of this size to be passed to `CacheWriter.writeAll(Collection)` or `CacheWriter.deleteAll(Collection)` methods.

If not provided, default value is `DFLT_WRITE_BEHIND_BATCH_SIZE`.

Returns:
  Maximum batch size for store operations.

#### setWriteBehindBatchSize

    public CacheConfiguration setWriteBehindBatchSize(int writeBehindBatchSize)

Sets maximum batch size for write-behind cache.

Parameters:
  `writeBehindBatchSize` - Maximum batch size.
Returns:
  `this` for chaining.
See Also:
  `getWriteBehindBatchSize()`

#### getRebalanceThreadPoolSize

    public int getRebalanceThreadPoolSize()

Gets size of rebalancing thread pool. Note that size serves as a hint and implementation may create more threads for rebalancing than specified here (but never less threads).

Default value is `DFLT_REBALANCE_THREAD_POOL_SIZE`.

Returns:
  Size of rebalancing thread pool.

#### setRebalanceThreadPoolSize

    public CacheConfiguration setRebalanceThreadPoolSize(int rebalancePoolSize)

Sets size of rebalancing thread pool. Note that size serves as a hint and implementation may create more threads for rebalancing than specified here (but never less threads).

Parameters:
  `rebalancePoolSize` - Size of rebalancing thread pool.
Returns:
  `this` for chaining.

#### getRebalanceTimeout

    public long getRebalanceTimeout()

Gets rebalance timeout (ms).

Default value is `DFLT_REBALANCE_TIMEOUT`.

Returns:
  Rebalance timeout (ms).

#### setRebalanceTimeout

    public CacheConfiguration setRebalanceTimeout(long rebalanceTimeout)

Sets rebalance timeout (ms).

Parameters:
  `rebalanceTimeout` - Rebalance timeout (ms).
Returns:
  `this` for chaining.

#### getRebalanceDelay

    public long getRebalanceDelay()

Gets delay in milliseconds upon a node joining or leaving topology (or crash) after which rebalancing should be started automatically. Rebalancing should be delayed if you plan to restart nodes after they leave topology, or if you plan to start multiple nodes at once or one after another and don't want to repartition and rebalance until all nodes are started.

For better efficiency user should usually make sure that new nodes get placed on the same place of consistent hash ring as the left nodes, and that nodes are restarted before this delay expires. To place nodes on the same place in consistent hash ring, use `RendezvousAffinityFunction.setHashIdResolver(AffinityNodeHashResolver)` to make sure that a node maps to the same hash ID event if restarted. As an example, node IP address and port combination may be used in this case.

Default value is `0` which means that repartitioning and rebalancing will start immediately upon node leaving topology. If `-1` is returned, then rebalancing will only be started manually by calling `IgniteCache.rebalance()` method or from management console.

Returns:
  Rebalancing delay, `0` to start rebalancing immediately, `-1` to start rebalancing manually, or positive value to specify delay in milliseconds after which rebalancing should start automatically.

#### setRebalanceDelay

    public CacheConfiguration setRebalanceDelay(long rebalanceDelay)

Sets rebalance delay (see `getRebalanceDelay()` for more information).

Parameters:
  `rebalanceDelay` - Rebalance delay to set.
Returns:
  `this` for chaining.

#### getRebalanceThrottle

    public long getRebalanceThrottle()

Time in milliseconds to wait between rebalance messages to avoid overloading of CPU or network. When rebalancing large data sets, the CPU or network can get over-consumed with rebalancing messages, which consecutively may slow down the application performance. This parameter helps tune the amount of time to wait between rebalance messages to make sure that rebalancing process does not have any negative performance impact. Note that application will continue to work properly while rebalancing is still in progress.

Value of `0` means that throttling is disabled. By default throttling is disabled - the default is defined by `DFLT_REBALANCE_THROTTLE` constant.

Returns:
  Time in milliseconds to wait between rebalance messages to avoid overloading of CPU, `0` to disable throttling.

#### setRebalanceThrottle

    public CacheConfiguration setRebalanceThrottle(long rebalanceThrottle)

Time in milliseconds to wait between rebalance messages to avoid overloading of CPU or network. When rebalancing large data sets, the CPU or network can get over-consumed with rebalancing messages, which consecutively may slow down the application performance. This parameter helps tune the amount of time to wait between rebalance messages to make sure that rebalancing process does not have any negative performance impact. Note that application will continue to work properly while rebalancing is still in progress.

Value of `0` means that throttling is disabled. By default throttling is disabled - the default is defined by `DFLT_REBALANCE_THROTTLE` constant.

Parameters:
  `rebalanceThrottle` - Time in milliseconds to wait between rebalance messages to avoid overloading of CPU, `0` to disable throttling.
Returns:
  `this` for chaining.

#### getAffinityMapper

    public AffinityKeyMapper getAffinityMapper()

Affinity key mapper used to provide custom affinity key for any given key. Affinity mapper is particularly useful when several objects need to be collocated on the same node (they will also be backed up on the same nodes as well).

If not provided, then default implementation will be used. The default behavior is described in `AffinityKeyMapper` documentation.

Returns:
  Mapper to use for affinity key mapping.

#### setAffinityMapper

    public CacheConfiguration setAffinityMapper(AffinityKeyMapper affMapper)

Sets custom affinity mapper. If not provided, then default implementation will be used. The default behavior is described in `AffinityKeyMapper` documentation.

Parameters:
  `affMapper` - Affinity mapper.
Returns:
  `this` for chaining.

#### getOffHeapMaxMemory

    public long getOffHeapMaxMemory()

Gets maximum amount of memory available to off-heap storage. Possible values are

- `-1` - Means that off-heap storage is disabled.
- `0` - Ignite will not limit off-heap storage (it's up to user to properly add and remove entries from cache to ensure that off-heap storage does not grow indefinitely.
- Any positive value specifies the limit of off-heap storage in bytes.

Default value is `-1`, specified by `DFLT_OFFHEAP_MEMORY` constant which means that off-heap storage is disabled by default.

Use off-heap storage to load gigabytes of data in memory without slowing down Garbage Collection. Essentially in this case you should allocate very small amount of memory to JVM and Ignite will cache most of the data in off-heap space without affecting JVM performance at all.

Note that Ignite will throw an exception if max memory is set to `-1` and `offHeapValuesOnly` flag is set to `true`.

Returns:
  Maximum memory in bytes available to off-heap memory space.

#### setOffHeapMaxMemory

    public CacheConfiguration setOffHeapMaxMemory(long offHeapMaxMem)

Sets maximum amount of memory available to off-heap storage. Possible values are

- `-1` - Means that off-heap storage is disabled.
- `0` - Ignite will not limit off-heap storage (it's up to user to properly add and remove entries from cache to ensure that off-heap storage does not grow infinitely.
- Any positive value specifies the limit of off-heap storage in bytes.

Default value is `-1`, specified by `DFLT_OFFHEAP_MEMORY` constant which means that off-heap storage is disabled by default.

Use off-heap storage to load gigabytes of data in memory without slowing down Garbage Collection. Essentially in this case you should allocate very small amount of memory to JVM and Ignite will cache most of the data in off-heap space without affecting JVM performance at all.

Parameters:
  `offHeapMaxMem` - Maximum memory in bytes available to off-heap memory space.
Returns:
  `this` for chaining.

#### getMemoryMode

    public CacheMemoryMode getMemoryMode()

Gets memory mode for cache. Memory mode helps control whether value is stored in on-heap memory, off-heap memory, or swap space. Refer to `CacheMemoryMode` for more info.

Default value is `DFLT_MEMORY_MODE`.

Returns:
  Memory mode.

#### setMemoryMode

    public CacheConfiguration setMemoryMode(CacheMemoryMode memMode)

Sets memory mode for cache.

Parameters:
  `memMode` - Memory mode.
Returns:
  `this` for chaining.

#### getInterceptor

    @Nullable
    public CacheInterceptor<K,V> getInterceptor()

Gets cache interceptor.

Returns:
  Cache interceptor.

#### setInterceptor

    public CacheConfiguration setInterceptor(CacheInterceptor<K,V> interceptor)

Sets cache interceptor.

Parameters:
  `interceptor` - Cache interceptor.
Returns:
  `this` for chaining.

#### getTypeMetadata

    public Collection<CacheTypeMetadata> getTypeMetadata()

Gets collection of type metadata objects.

Returns:
  Collection of type metadata.

#### setTypeMetadata

    public CacheConfiguration setTypeMetadata(Collection<CacheTypeMetadata> typeMeta)

Sets collection of type metadata objects.

Parameters:
  `typeMeta` - Collection of type metadata.
Returns:
  `this` for chaining.

#### isReadFromBackup

    public boolean isReadFromBackup()

Gets flag indicating whether data can be read from backup. If `false` always get data from primary node (never from backup).

Default value is defined by `DFLT_READ_FROM_BACKUP`.

Returns:
  `true` if data can be read from backup node or `false` if data always should be read from primary node and never from backup.

#### setReadFromBackup

    public CacheConfiguration setReadFromBackup(boolean readFromBackup)

Sets read from backup flag.

Parameters:
  `readFromBackup` - `true` to allow reads from backups.
Returns:
  `this` for chaining.

#### isCopyOnRead

    public boolean isCopyOnRead()

Gets flag indicating whether copy of of the value stored in cache should be created for cache operation implying return value. Also if this flag is set copies are created for values passed to `CacheInterceptor` and to `CacheEntryProcessor`.

Returns:
  Copy on read flag.

#### setCopyOnRead

    public CacheConfiguration setCopyOnRead(boolean cpOnRead)

Sets copy on read flag.

Parameters:
  `cpOnRead` - Copy on get flag.
Returns:
  `this` for chaining.
See Also:
  `isCopyOnRead()`

#### setSqlFunctionClasses

    public CacheConfiguration setSqlFunctionClasses(Class<?>... cls)

Sets classes with methods annotated by `QuerySqlFunction` to be used as user-defined functions from SQL queries.

Parameters:
  `cls` - One or more classes with SQL functions.
Returns:
  `this` for chaining.

#### getSqlFunctionClasses

    @Nullable
    public Class<?>[] getSqlFunctionClasses()

Gets classes with methods annotated by `QuerySqlFunction` to be used as user-defined functions from SQL queries.

Returns:
  Classes with SQL functions.

#### getLongQueryWarningTimeout

    public long getLongQueryWarningTimeout()

Gets timeout in milliseconds after which long query warning will be printed.

Returns:
  Timeout in milliseconds.

#### setLongQueryWarningTimeout

    public CacheConfiguration setLongQueryWarningTimeout(long longQryWarnTimeout)

Gets timeout in milliseconds after which long query warning will be printed.

Parameters:
  `longQryWarnTimeout` - Timeout in milliseconds.
Returns:
  `this` for chaining.

#### isSqlEscapeAll

    public boolean isSqlEscapeAll()

If `true` all the SQL table and field names will be escaped with double quotes like (`"tableName"."fieldsName"`). This enforces case sensitivity for field names and also allows having special characters in table and field names.

Returns:
  Flag value.

#### setSqlEscapeAll

    public CacheConfiguration setSqlEscapeAll(boolean sqlEscapeAll)

If `true` all the SQL table and field names will be escaped with double quotes like (`"tableName"."fieldsName"`). This enforces case sensitivity for field names and also allows having special characters in table and field names.

Parameters:
  `sqlEscapeAll` - Flag value.
Returns:
  `this` for chaining.

#### getIndexedTypes

    public Class<?>[] getIndexedTypes()

Array of key and value type pairs to be indexed (thus array length must be always even). It means each even (0,2,4...) class in the array will be considered as key type for cache entry, each odd (1,3,5...) class will be considered as value type for cache entry.

The same key class can occur multiple times for different value classes, but each value class must be unique because SQL table will be named as value class simple name.

To expose fields of these types onto SQL level and to index them you have to use annotations from package `org.apache.ignite.cache.query.annotations`.

Returns:
  Key and value type pairs.

#### setIndexedTypes

    public CacheConfiguration setIndexedTypes(Class<?>... indexedTypes)

Array of key and value type pairs to be indexed (thus array length must be always even). It means each even (0,2,4...) class in the array will be considered as key type for cache entry, each odd (1,3,5...) class will be considered as value type for cache entry.

The same key class can occur multiple times for different value classes, but each value class must be unique because SQL table will be named as value class simple name.

To expose fields of these types onto SQL level and to index them you have to use annotations from package `org.apache.ignite.cache.query.annotations`.

Parameters:
  `indexedTypes` - Key and value type pairs.
Returns:
  `this` for chaining.

#### getSqlOnheapRowCacheSize

    public int getSqlOnheapRowCacheSize()

Number of SQL rows which will be cached onheap to avoid deserialization on each SQL index access. This setting only makes sense when offheap is enabled for this cache.

Returns:
  Cache size.
See Also:
  `setOffHeapMaxMemory(long)`

#### setSqlOnheapRowCacheSize

    public CacheConfiguration setSqlOnheapRowCacheSize(int size)

Number of SQL rows which will be cached onheap to avoid deserialization on each SQL index access. This setting only makes sense when offheap is enabled for this cache.

Parameters:
  `size` - Cache size.
Returns:
  `this` for chaining.
See Also:
  `setOffHeapMaxMemory(long)`

#### getPluginConfigurations

    public CachePluginConfiguration[] getPluginConfigurations()

Gets array of cache plugin configurations.

Returns:
  Cache plugin configurations.

#### setPluginConfigurations

    public CacheConfiguration setPluginConfigurations(CachePluginConfiguration... pluginCfgs)

Sets cache plugin configurations.

Parameters:
  `pluginCfgs` - Cache plugin configurations.
Returns:
  `this` for chaining.

#### getTopologyValidator

    public TopologyValidator getTopologyValidator()

Gets topology validator.

Returns:
  validator.

#### setTopologyValidator

    public CacheConfiguration setTopologyValidator(TopologyValidator topValidator)

Sets topology validator.

Parameters:
  `topValidator` - validator.
Returns:
  `this` for chaining.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.1.0-incubating
Release Date | : May 20 2015