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

### Field Summary

Fields
`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 CacheDistributionMode` `DFLT_DISTRIBUTION_MODE` Default value for cache distribution mode.
`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_NEAR_SYNCHRONIZED` Default near nodes eviction synchronized flag.
`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 int` `DFLT_MAX_CONCURRENT_ASYNC_OPS` Default value for 'maxConcurrentAsyncOps'.
`static float` `DFLT_MAX_EVICTION_OVERFLOW_RATIO` Default maximum eviction queue ratio.
`static int` `DFLT_MAX_QUERY_ITERATOR_CNT` Default maximum number of query iterators that can be stored.
`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 int` `DFLT_PRELOAD_BATCH_SIZE` Default preload batch size in bytes.
`static CachePreloadMode` `DFLT_PRELOAD_MODE` Default preload mode for distributed cache.
`static int` `DFLT_PRELOAD_THREAD_POOL_SIZE` Default size of preload thread pool.
`static long` `DFLT_PRELOAD_THROTTLE` Time in milliseconds to wait between preload messages to avoid overloading CPU.
`static long` `DFLT_PRELOAD_TIMEOUT` Default preload timeout (ms).
`static boolean` `DFLT_QUERY_INDEX_ENABLED` Default value for 'queryIndexEnabled' flag.
`static long` `DFLT_QUERY_TIMEOUT` Default query timeout.
`static boolean` `DFLT_READ_FROM_BACKUP` Default value for 'readFromBackup' flag.
`static int` `DFLT_START_SIZE` Initial default cache size.
`static boolean` `DFLT_STORE_VALUE_BYTES` Default value for 'storeValueBytes' flag indicating if value bytes should be stored.
`static boolean` `DFLT_SWAP_ENABLED` Default value for 'swapEnabled' flag.
`static long` `DFLT_TIME_TO_LIVE` Default time to live.
`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.

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

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

### Constructor Summary

Constructors
Constructor and Description
`CacheConfiguration()` Empty constructor (all values are initialized to their defaults).
`CacheConfiguration(javax.cache.configuration.CompleteConfiguration cfg)` Copy constructor.

### Method Summary

Methods
`CacheAffinityFunction` `getAffinity()` Gets key topology resolver to provide mapping from keys to nodes.
`CacheAffinityKeyMapper` `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.
`long` `getDefaultQueryTimeout()` Gets default query timeout.
`long` `getDefaultTimeToLive()` Gets time to live for all objects in cache.
`CacheDistributionMode` `getDistributionMode()` Gets cache distribution mode.
`CacheEvictionFilter<K,V>` `getEvictionFilter()` Gets eviction filter to specify which entries should not be evicted (except explicit evict by calling `IgniteCache.localEvict(Collection)`).
`CacheEvictionPolicy<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.
`String` `getIndexingSpiName()` Gets name of the SPI to use for indexing.
`CacheInterceptor<K,V>` `getInterceptor()` Gets cache interceptor.
`int` `getMaxConcurrentAsyncOperations()` Gets maximum number of allowed concurrent asynchronous operations.
`int` `getMaximumQueryIteratorCount()` Gets maximum number of query iterators that can be stored.
`CacheMemoryMode` `getMemoryMode()` Gets memory mode for cache.
`String` `getName()` Cache name.
`CacheEvictionPolicy<K,V>` `getNearEvictionPolicy()` Gets eviction policy for `near` cache which is different from the one used for `partitioned` cache.
`int` `getNearStartSize()` Gets initial cache size for near cache which will be used to pre-create internal hash table after start.
`long` `getOffHeapMaxMemory()` Gets maximum amount of memory available to off-heap storage.
`int` `getPreloadBatchSize()` Gets size (in number bytes) to be loaded within a single preload message.
`CachePreloadMode` `getPreloadMode()` Gets preload mode for distributed cache.
`int` `getPreloadOrder()` Gets cache preload order.
`long` `getPreloadPartitionedDelay()` Gets delay in milliseconds upon a node joining or leaving topology (or crash) after which preloading should be started automatically.
`int` `getPreloadThreadPoolSize()` Gets size of preloading thread pool.
`long` `getPreloadThrottle()` Time in milliseconds to wait between preload messages to avoid overloading of CPU or network.
`long` `getPreloadTimeout()` Gets preload timeout (ms).
`CacheQueryConfiguration` `getQueryConfiguration()` Gets query configuration.
`int` `getStartSize()` Gets initial cache size which will be used to pre-create internal hash table after start.
`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` `isEagerTtl()` Gets flag indicating whether expired cache entries will be eagerly removed from cache.
`boolean` `isEvictNearSynchronized()` Gets flag indicating whether eviction on primary node is synchronized with near nodes where entry is kept.
`boolean` `isEvictSynchronized()` Gets flag indicating whether eviction is synchronized between primary and backup nodes on partitioned cache.
`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` `isQueryIndexEnabled()` Flag indicating whether Ignite should attempt to index value and/or key instances stored in cache.
`boolean` `isReadFromBackup()` Gets flag indicating whether data can be read from backup.
`boolean` `isStoreValueBytes()` Flag indicating if cached values should be additionally stored in serialized form.
`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.
`void` `setAffinity(CacheAffinityFunction aff)` Sets affinity for cache keys.
`void` `setAffinityMapper(CacheAffinityKeyMapper affMapper)` Sets custom affinity mapper.
`void` `setAtomicityMode(CacheAtomicityMode atomicityMode)` Sets cache atomicity mode.
`void` `setAtomicWriteOrderMode(CacheAtomicWriteOrderMode atomicWriteOrderMode)` Sets cache write ordering mode.
`void` `setBackups(int backups)` Sets number of nodes used to back up single partition for `CacheMode.PARTITIONED` cache.
`void` `setCacheMode(CacheMode cacheMode)` Sets caching mode.
`void` `setCacheStoreFactory(javax.cache.configuration.Factory<? extends CacheStore<? super K,? super V>> storeFactory)` Sets factory fpr persistent storage for cache data.
`void` `setDefaultLockTimeout(long dfltLockTimeout)` Sets default lock timeout in milliseconds.
`void` `setDefaultQueryTimeout(long dfltQryTimeout)` Sets default query timeout, `0` for never.
`void` `setDefaultTimeToLive(long ttl)` Sets time to live for all objects in cache.
`void` `setDistributionMode(CacheDistributionMode distro)` Sets cache distribution mode.
`void` `setEagerTtl(boolean eagerTtl)` Sets eager ttl flag.
`void` `setEvictionFilter(CacheEvictionFilter<K,V> evictFilter)` Sets eviction filter.
`void` `setEvictionPolicy(CacheEvictionPolicy evictPlc)` Sets cache eviction policy.
`void` `setEvictMaxOverflowRatio(float evictMaxOverflowRatio)` Sets maximum eviction overflow ratio.
`void` `setEvictNearSynchronized(boolean evictNearSync)` Sets flag indicating whether eviction is synchronized with near nodes.
`void` `setEvictSynchronized(boolean evictSync)` Sets flag indicating whether eviction is synchronized with backup nodes (or the rest of the nodes for replicated cache).
`void` `setEvictSynchronizedConcurrencyLevel(int evictSyncConcurrencyLvl)` Sets concurrency level for synchronized evictions.
`void` `setEvictSynchronizedKeyBufferSize(int evictKeyBufSize)` Sets eviction key buffer size.
`void` `setEvictSynchronizedTimeout(long evictSyncTimeout)` Sets timeout for synchronized evictions.
`void` `setIndexingSpiName(String indexingSpiName)` Sets name of the SPI to use for indexing.
`void` `setInterceptor(CacheInterceptor<K,V> interceptor)` Sets cache interceptor.
`void` `setInvalidate(boolean invalidate)` Sets invalidation flag for near cache entries in this transaction.

`void`

`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`.

`void` `setMaxConcurrentAsyncOperations(int maxConcurrentAsyncOps)` Sets maximum number of concurrent asynchronous operations.
`void` `setMaximumQueryIteratorCount(int maxQryIterCnt)` Sets maximum number of query iterators that can be stored.
`void` `setMemoryMode(CacheMemoryMode memMode)` Sets memory mode for cache.
`void` `setName(String name)` Sets cache name.
`void` `setNearEvictionPolicy(CacheEvictionPolicy nearEvictPlc)` Sets eviction policy for near cache.
`void` `setNearStartSize(int nearStartSize)` Start size for near cache.
`void` `setOffHeapMaxMemory(long offHeapMaxMem)` Sets maximum amount of memory available to off-heap storage.
`void` `setPreloadBatchSize(int preloadBatchSize)` Sets preload batch size.
`void` `setPreloadMode(CachePreloadMode preloadMode)` Sets cache preload mode.
`void` `setPreloadOrder(int preloadOrder)` Sets cache preload order.
`void` `setPreloadPartitionedDelay(long preloadDelay)` Sets preload delay (see `getPreloadPartitionedDelay()` for more information).
`void` `setPreloadThreadPoolSize(int preloadPoolSize)` Sets size of preloading thread pool.
`void` `setPreloadThrottle(long preloadThrottle)` Time in milliseconds to wait between preload messages to avoid overloading of CPU or network.
`void` `setPreloadTimeout(long preloadTimeout)` Sets preload timeout (ms).
`void` `setQueryConfiguration(CacheQueryConfiguration qryCfg)` Sets query configuration.
`void` `setQueryIndexEnabled(boolean qryIdxEnabled)` Flag indicating whether query indexing is enabled or not.
`void` `setReadFromBackup(boolean readFromBackup)` Sets read from backup flag.
`void` `setStartSize(int startSize)` Initial size for internal hash map.
`void` `setStoreValueBytes(boolean storeValBytes)` Flag indicating if cached values should be additionally stored in serialized form.
`void` `setSwapEnabled(boolean swapEnabled)` Flag indicating whether swap storage is enabled or not.
`void` `setTransactionManagerLookupClassName(String tmLookupClsName)` Sets look up mechanism for available `TransactionManager` implementation, if any.
`void` `setTypeMetadata(Collection<CacheTypeMetadata> typeMeta)` Sets collection of type metadata objects.
`void` `setWriteBehindBatchSize(int writeBehindBatchSize)` Sets maximum batch size for write-behind cache.
`void` `setWriteBehindEnabled(boolean writeBehindEnabled)` Sets flag indicating whether write-behind is enabled.
`void` `setWriteBehindFlushFrequency(long writeBehindFlushFreq)` Sets write-behind flush frequency.
`void` `setWriteBehindFlushSize(int writeBehindFlushSize)` Sets write-behind flush size.
`void` `setWriteBehindFlushThreadCount(int writeBehindFlushThreadCnt)` Sets flush thread count for write-behind cache.
`void` `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_PRELOAD_THREAD_POOL_SIZE

    public static final int DFLT_PRELOAD_THREAD_POOL_SIZE

Default size of preload thread pool.

See Also:
  Constant Field Values

#### DFLT_PRELOAD_TIMEOUT

    public static final long DFLT_PRELOAD_TIMEOUT

Default preload timeout (ms).

See Also:
  Constant Field Values

#### DFLT_PRELOAD_THROTTLE

    public static final long DFLT_PRELOAD_THROTTLE

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

See Also:
  Constant Field Values

#### DFLT_TIME_TO_LIVE

    public static final long DFLT_TIME_TO_LIVE

Default time to live. The value is `0` which means that cached objects never expire based on time.

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_DISTRIBUTION_MODE

    public static final CacheDistributionMode DFLT_DISTRIBUTION_MODE

Default value for cache distribution mode.

#### DFLT_QUERY_TIMEOUT

    public static final long DFLT_QUERY_TIMEOUT

Default query timeout.

See Also:
  Constant Field Values

#### 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_STORE_VALUE_BYTES

    public static final boolean DFLT_STORE_VALUE_BYTES

Default value for 'storeValueBytes' flag indicating if value bytes should be stored.

See Also:
  Constant Field Values

#### DFLT_PRELOAD_MODE

    public static final CachePreloadMode DFLT_PRELOAD_MODE

Default preload mode for distributed cache.

#### DFLT_PRELOAD_BATCH_SIZE

    public static final int DFLT_PRELOAD_BATCH_SIZE

Default preload 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_NEAR_SYNCHRONIZED

    public static final boolean DFLT_EVICT_NEAR_SYNCHRONIZED

Default near nodes 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_QUERY_INDEX_ENABLED

    public static final boolean DFLT_QUERY_INDEX_ENABLED

Default value for 'queryIndexEnabled' flag.

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_MAX_QUERY_ITERATOR_CNT

    public static final int DFLT_MAX_QUERY_ITERATOR_CNT

Default maximum number of query iterators that can be stored.

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

### Constructor Detail

#### CacheConfiguration

    public CacheConfiguration()

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

#### CacheConfiguration

    public CacheConfiguration(javax.cache.configuration.CompleteConfiguration cfg)

Copy constructor.

Parameters:
  `cfg` - Configuration to copy.

### Method Detail

#### getName

    public String getName()

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

Returns:
  Cache name.

#### setName

    public void setName(String name)

Sets cache name.

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

#### getDefaultTimeToLive

    public long getDefaultTimeToLive()

Gets time to live for all objects in cache. This value can be overridden for individual objects. If not set, then value is `0` which means that objects never expire.

Returns:
  Time to live for all objects in cache.

#### setDefaultTimeToLive

    public void setDefaultTimeToLive(long ttl)

Sets time to live for all objects in cache. This value can be override for individual objects.

Parameters:
  `ttl` - Time to live for all objects in cache.

#### getEvictionPolicy

    @Nullable
    public CacheEvictionPolicy<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 void setEvictionPolicy(@Nullable
                         CacheEvictionPolicy evictPlc)

Sets cache eviction policy.

Parameters:
  `evictPlc` - Cache expiration policy.

#### getDistributionMode

    public CacheDistributionMode getDistributionMode()

Gets cache distribution mode. This parameter is taken into account only if `getCacheMode()` is set to `CacheMode.PARTITIONED` or `CacheMode.REPLICATED` mode.

If not set, default value is `DFLT_DISTRIBUTION_MODE`.

Returns:
  Cache distribution mode.

#### setDistributionMode

    public void setDistributionMode(CacheDistributionMode distro)

Sets cache distribution mode.

Parameters:
  `distro` - Distribution mode.

#### 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 void setWriteSynchronizationMode(CacheWriteSynchronizationMode writeSync)

Sets write synchronization mode.

Parameters:
  `writeSync` - Write synchronization mode.

#### getNearEvictionPolicy

    @Nullable
    public CacheEvictionPolicy<K,V> getNearEvictionPolicy()

Gets eviction policy for `near` cache which is different from the one used for `partitioned` cache. By default, returns `null` which means that evictions are disabled for near cache.

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

#### setNearEvictionPolicy

    public void setNearEvictionPolicy(@Nullable
                             CacheEvictionPolicy nearEvictPlc)

Sets eviction policy for near cache. This property is only used for `CacheMode.PARTITIONED` caching mode.

Parameters:
  `nearEvictPlc` - Eviction policy for near cache.

#### isEvictSynchronized

    public boolean isEvictSynchronized()

Gets flag indicating whether eviction is synchronized between primary and backup nodes on partitioned cache. If this parameter is `true` and swap is disabled then `CacheProjection.evict(Object)` and all its variations will involve all nodes where an entry is kept - this is a group of nodes responsible for partition to which corresponding key belongs. If this property is set to `false` then eviction is done independently on 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 void setEvictSynchronized(boolean evictSync)

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

Parameters:
  `evictSync` - `true` if synchronized, `false` if not.

#### setEvictNearSynchronized

    public void setEvictNearSynchronized(boolean evictNearSync)

Sets flag indicating whether eviction is synchronized with near nodes.

Parameters:
  `evictNearSync` - `true` if synchronized, `false` if not.

#### isEvictNearSynchronized

    public boolean isEvictNearSynchronized()

Gets flag indicating whether eviction on primary node is synchronized with near nodes where entry is kept. Default value is `true` and is defined by `DFLT_EVICT_NEAR_SYNCHRONIZED`.

Note that in most cases this property should be set to `true` to keep cache consistency. But there may be the cases when user may use some special near eviction policy to have desired control over near cache entry set.

Returns:
  `true` If eviction is synchronized with near nodes in partitioned cache, `false` if not.

#### 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 void setEvictSynchronizedKeyBufferSize(int evictKeyBufSize)

Sets eviction key buffer size.

Parameters:
  `evictKeyBufSize` - Eviction key buffer size.

#### getEvictSynchronizedConcurrencyLevel

    public int getEvictSynchronizedConcurrencyLevel()

Gets concurrency level for synchronized evictions. This flag only makes sense with `isEvictNearSynchronized()` or `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 void setEvictSynchronizedConcurrencyLevel(int evictSyncConcurrencyLvl)

Sets concurrency level for synchronized evictions.

Parameters:
  `evictSyncConcurrencyLvl` - Concurrency level for synchronized evictions.

#### 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 void setEvictSynchronizedTimeout(long evictSyncTimeout)

Sets timeout for synchronized evictions.

Parameters:
  `evictSyncTimeout` - Timeout for synchronized evictions.

#### 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 void setEvictMaxOverflowRatio(float evictMaxOverflowRatio)

Sets maximum eviction overflow ratio.

Parameters:
  `evictMaxOverflowRatio` - Maximum eviction overflow ratio.

#### getEvictionFilter

    public CacheEvictionFilter<K,V> getEvictionFilter()

Gets eviction filter to specify which entries should not be evicted (except explicit evict by calling `IgniteCache.localEvict(Collection)`). If `CacheEvictionFilter.evictAllowed(javax.cache.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 void setEvictionFilter(CacheEvictionFilter<K,V> evictFilter)

Sets eviction filter.

Parameters:
  `evictFilter` - Eviction filter.

#### 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 `CacheEvictionPolicy`.

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

#### setEagerTtl

    public void setEagerTtl(boolean eagerTtl)

Sets eager ttl flag.

Parameters:
  `eagerTtl` - `True` if Ignite should eagerly remove expired cache entries.
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 void setStartSize(int startSize)

Initial size for internal hash map.

Parameters:
  `startSize` - Cache start size.

#### getNearStartSize

    public int getNearStartSize()

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

Returns:
  Initial near cache size.

#### setNearStartSize

    public void setNearStartSize(int nearStartSize)

Start size for near cache. This property is only used for `CacheMode.PARTITIONED` caching mode.

Parameters:
  `nearStartSize` - Start size for near cache.

#### 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 void 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.

#### 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 void 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 CacheAffinityFunction 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 void setAffinity(CacheAffinityFunction aff)

Sets affinity for cache keys.

Parameters:
  `aff` - Cache key affinity.

#### 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 void setCacheMode(CacheMode cacheMode)

Sets caching mode.

Parameters:
  `cacheMode` - Caching mode.

#### getAtomicityMode

    public CacheAtomicityMode getAtomicityMode()

Gets cache atomicity mode.

Default value is defined by `DFLT_CACHE_ATOMICITY_MODE`.

Returns:
  Cache atomicity mode.

#### setAtomicityMode

    public void setAtomicityMode(CacheAtomicityMode atomicityMode)

Sets cache atomicity mode.

Parameters:
  `atomicityMode` - Cache atomicity mode.

#### 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 void 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.

#### 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 void 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.

#### 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 void setDefaultLockTimeout(long dfltLockTimeout)

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

Parameters:
  `dfltLockTimeout` - Default lock timeout.

#### getDefaultQueryTimeout

    public long getDefaultQueryTimeout()

Gets default query timeout. Default value is defined by `DFLT_QUERY_TIMEOUT`. `0` (zero) means that the query will never timeout and will wait for completion.

Returns:
  Default query timeout, `0` for never.

#### setDefaultQueryTimeout

    public void setDefaultQueryTimeout(long dfltQryTimeout)

Sets default query timeout, `0` for never. For more information see `getDefaultQueryTimeout()`.

Parameters:
  `dfltQryTimeout` - Default query timeout.

#### isInvalidate

    public boolean isInvalidate()

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

Returns:
  Invalidation flag.

#### setInvalidate

    public void 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`.

#### setStoreValueBytes

    public void setStoreValueBytes(boolean storeValBytes)

Flag indicating if cached values should be additionally stored in serialized form. It's set to true by default.

Parameters:
  `storeValBytes` - `true` if cached values should be additionally stored in serialized form, `false` otherwise.

#### isStoreValueBytes

    public boolean isStoreValueBytes()

Flag indicating if cached values should be additionally stored in serialized form. It's set to `true` by default.

Returns:
  `true` if cached values should be additionally stored in serialized form, `false` otherwise.

#### getTransactionManagerLookupClassName

    public String getTransactionManagerLookupClassName()

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

Returns:
  Transaction manager finder.

#### setTransactionManagerLookupClassName

    public void 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.

#### setPreloadMode

    public void setPreloadMode(CachePreloadMode preloadMode)

Sets cache preload mode.

Parameters:
  `preloadMode` - Preload mode.

#### getPreloadMode

    public CachePreloadMode getPreloadMode()

Gets preload mode for distributed cache.

Default is defined by `DFLT_PRELOAD_MODE`.

Returns:
  Preload mode.

#### getPreloadOrder

    public int getPreloadOrder()

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

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

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

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

Returns:
  Cache preload order.

#### setPreloadOrder

    public void setPreloadOrder(int preloadOrder)

Sets cache preload order.

Parameters:
  `preloadOrder` - Cache preload order.
See Also:
  `getPreloadOrder()`

#### getPreloadBatchSize

    public int getPreloadBatchSize()

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

Returns:
  Size in bytes of a single preload message.

#### setPreloadBatchSize

    public void setPreloadBatchSize(int preloadBatchSize)

Sets preload batch size.

Parameters:
  `preloadBatchSize` - Preload batch size.

#### 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.

Note that this flag may be overridden for cache projection created with flag `CacheFlag.SKIP_SWAP`.

Returns:
  `True` if swap storage is enabled.

#### setSwapEnabled

    public void setSwapEnabled(boolean swapEnabled)

Flag indicating whether swap storage is enabled or not.

Parameters:
  `swapEnabled` - `True` if swap storage is enabled.

#### 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 void setMaxConcurrentAsyncOperations(int maxConcurrentAsyncOps)

Sets maximum number of concurrent asynchronous operations.

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

#### isQueryIndexEnabled

    public boolean isQueryIndexEnabled()

Flag indicating whether Ignite should attempt to index value and/or key instances stored in cache. If this property is `false`, then all indexing annotations inside of any class will be ignored. By default query indexing is disabled and defined via `DFLT_QUERY_INDEX_ENABLED` constant.

Returns:
  `True` if query indexing is enabled.
See Also:
  `getMemoryMode()`

#### setQueryIndexEnabled

    public void setQueryIndexEnabled(boolean qryIdxEnabled)

Flag indicating whether query indexing is enabled or not.

Parameters:
  `qryIdxEnabled` - `True` if query indexing is enabled.

#### 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 void setWriteBehindEnabled(boolean writeBehindEnabled)

Sets flag indicating whether write-behind is enabled.

Parameters:
  `writeBehindEnabled` - `true` if write-behind is enabled.

#### 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 void setWriteBehindFlushSize(int writeBehindFlushSize)

Sets write-behind flush size.

Parameters:
  `writeBehindFlushSize` - Write-behind cache flush size.
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 void setWriteBehindFlushFrequency(long writeBehindFlushFreq)

Sets write-behind flush frequency.

Parameters:
  `writeBehindFlushFreq` - Write-behind flush frequency in milliseconds.
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 void setWriteBehindFlushThreadCount(int writeBehindFlushThreadCnt)

Sets flush thread count for write-behind cache.

Parameters:
  `writeBehindFlushThreadCnt` - Count of flush threads.
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 void setWriteBehindBatchSize(int writeBehindBatchSize)

Sets maximum batch size for write-behind cache.

Parameters:
  `writeBehindBatchSize` - Maximum batch size.
See Also:
  `getWriteBehindBatchSize()`

#### getPreloadThreadPoolSize

    public int getPreloadThreadPoolSize()

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

Default value is `DFLT_PRELOAD_THREAD_POOL_SIZE`.

Returns:
  Size of preloading thread pool.

#### setPreloadThreadPoolSize

    public void setPreloadThreadPoolSize(int preloadPoolSize)

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

Parameters:
  `preloadPoolSize` - Size of preloading thread pool.

#### getPreloadTimeout

    public long getPreloadTimeout()

Gets preload timeout (ms).

Default value is `DFLT_PRELOAD_TIMEOUT`.

Returns:
  Preload timeout (ms).

#### setPreloadTimeout

    public void setPreloadTimeout(long preloadTimeout)

Sets preload timeout (ms).

Parameters:
  `preloadTimeout` - Preload timeout (ms).

#### getPreloadPartitionedDelay

    public long getPreloadPartitionedDelay()

Gets delay in milliseconds upon a node joining or leaving topology (or crash) after which preloading should be started automatically. Preloading 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 preload until all nodes are started.

Delayed preloading is applied to `CacheMode.PARTITIONED` caches only. 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 `CacheConsistentHashAffinityFunction.setHashIdResolver(org.apache.ignite.cache.affinity.CacheAffinityNodeHashResolver)` 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 preloading will start immediately upon node leaving topology. If `-1` is returned, then preloading will only be started manually by calling `GridCache.forceRepartition()` method or from management console.

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

#### setPreloadPartitionedDelay

    public void setPreloadPartitionedDelay(long preloadDelay)

Sets preload delay (see `getPreloadPartitionedDelay()` for more information).

Parameters:
  `preloadDelay` - Preload delay to set.

#### getPreloadThrottle

    public long getPreloadThrottle()

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

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

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

#### setPreloadThrottle

    public void setPreloadThrottle(long preloadThrottle)

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

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

Parameters:
  `preloadThrottle` - Time in milliseconds to wait between preload messages to avoid overloading of CPU, `0` to disable throttling.

#### getAffinityMapper

    public CacheAffinityKeyMapper 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 `CacheAffinityKeyMapper` documentation.

Returns:
  Mapper to use for affinity key mapping.

#### setAffinityMapper

    public void setAffinityMapper(CacheAffinityKeyMapper affMapper)

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

Parameters:
  `affMapper` - Affinity mapper.

#### getIndexingSpiName

    public String getIndexingSpiName()

Gets name of the SPI to use for indexing. If not specified, the default indexing SPI will be used.

This property becomes useful in rare cases when more than one indexing SPI is configured. In majority of the cases default value should be used.

Returns:
  Name of SPI to use for indexing.
See Also:
  `IndexingSpi`

#### setIndexingSpiName

    public void setIndexingSpiName(String indexingSpiName)

Sets name of the SPI to use for indexing. If not specified, the default indexing SPI will be used.

This property becomes useful in rare cases when more than one indexing SPI is configured. In majority of the cases default value should be used.

Parameters:
  `indexingSpiName` - Name.
See Also:
  `IndexingSpi`

#### 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 void 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.

#### getMaximumQueryIteratorCount

    public int getMaximumQueryIteratorCount()

Gets maximum number of query iterators that can be stored. Iterators are stored to support query pagination when each page of data is sent to user's node only on demand. Increase this property if you are running and processing lots of queries in parallel.

Default value is `DFLT_MAX_QUERY_ITERATOR_CNT`.

Returns:
  Maximum number of query iterators that can be stored.

#### setMaximumQueryIteratorCount

    public void setMaximumQueryIteratorCount(int maxQryIterCnt)

Sets maximum number of query iterators that can be stored.

Parameters:
  `maxQryIterCnt` - Maximum number of query iterators that can be stored.

#### 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 void setMemoryMode(CacheMemoryMode memMode)

Sets memory mode for cache.

Parameters:
  `memMode` - Memory mode.

#### getInterceptor

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

Gets cache interceptor.

Returns:
  Cache interceptor.

#### setInterceptor

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

Sets cache interceptor.

Parameters:
  `interceptor` - Cache interceptor.

#### getTypeMetadata

    public Collection<CacheTypeMetadata> getTypeMetadata()

Gets collection of type metadata objects.

Returns:
  Collection of type metadata.

#### setTypeMetadata

    public void setTypeMetadata(Collection<CacheTypeMetadata> typeMeta)

Sets collection of type metadata objects.

Parameters:
  `typeMeta` - Collection of type metadata.

#### getQueryConfiguration

    public CacheQueryConfiguration getQueryConfiguration()

Gets query configuration. Query configuration defines which fields should be indexed for objects without annotations or portable objects.

Returns:
  Cache query configuration.

#### setQueryConfiguration

    public void setQueryConfiguration(CacheQueryConfiguration qryCfg)

Sets query configuration.

Parameters:
  `qryCfg` - Query configuration.

#### 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 void setReadFromBackup(boolean readFromBackup)

Sets read from backup flag.

Parameters:
  `readFromBackup` - `true` to allow reads from backups.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.0.0-RC1
Release Date | : February 17 2015