Class 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 Detail

      • MAX_PARTITIONS_COUNT

        public static final int MAX_PARTITIONS_COUNT
        Maximum number of partitions.
        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

        @Deprecated
        public static final long DFLT_LOCK_TIMEOUT
        Deprecated.
        Default lock timeout configuration property has no effect.
        Default lock timeout.
        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_SQL_INDEX_MAX_INLINE_SIZE

        public static final int DFLT_SQL_INDEX_MAX_INLINE_SIZE
        Default maximum inline size for sql indexes.
        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_EAGER_TTL

        public static final boolean DFLT_EAGER_TTL
        Default value for eager ttl 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_WRITE_BEHIND_COALESCING

        public static final boolean DFLT_WRITE_BEHIND_COALESCING
        Default write coalescing 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_READ_FROM_BACKUP

        public static final boolean DFLT_READ_FROM_BACKUP
        Default value for 'readFromBackup' flag.
        See Also:
        Constant Field Values
      • DFLT_LONG_QRY_WARN_TIMEOUT

        @Deprecated
        public static final long DFLT_LONG_QRY_WARN_TIMEOUT
        Deprecated.
        Default timeout after which long query warning will be printed.
        See Also:
        Constant Field Values
      • DFLT_QRY_DETAIL_METRICS_SIZE

        public static final int DFLT_QRY_DETAIL_METRICS_SIZE
        Default number of queries detail metrics to collect.
        See Also:
        Constant Field Values
      • DFLT_STORE_KEEP_BINARY

        public static final Boolean DFLT_STORE_KEEP_BINARY
        Default value for keep binary in store behavior .
      • DFLT_CONCURRENT_LOAD_ALL_THRESHOLD

        public static final int DFLT_CONCURRENT_LOAD_ALL_THRESHOLD
        Default threshold for concurrent loading of keys from CacheStore.
        See Also:
        Constant Field Values
      • DFLT_PARTITION_LOSS_POLICY

        public static final PartitionLossPolicy DFLT_PARTITION_LOSS_POLICY
        Default partition loss policy.
      • DFLT_QUERY_PARALLELISM

        public static final int DFLT_QUERY_PARALLELISM
        Default query parallelism.
        See Also:
        Constant Field Values
      • DFLT_EVENTS_DISABLED

        public static final boolean DFLT_EVENTS_DISABLED
        Default value for events disabled flag.
        See Also:
        Constant Field Values
      • DFLT_SQL_ONHEAP_CACHE_MAX_SIZE

        public static final int DFLT_SQL_ONHEAP_CACHE_MAX_SIZE
        Default SQL on-heap cache size.
        See Also:
        Constant Field Values
      • DFLT_DISK_PAGE_COMPRESSION

        public static final DiskPageCompression DFLT_DISK_PAGE_COMPRESSION
        Default disk page compression algorithm.
      • 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)
        Parameters:
        name - Cache name.
      • CacheConfiguration

        public CacheConfiguration​(javax.cache.configuration.CompleteConfiguration<K,​V> cfg)
        Copy constructor.
        Parameters:
        cfg - Configuration to copy.
    • Method Detail

      • setName

        public CacheConfiguration<K,​V> setName​(String name)
        Sets cache name.
        Parameters:
        name - Cache name. Can not be null or empty.
        Returns:
        this for chaining.
      • setDataRegionName

        public CacheConfiguration<K,​V> setDataRegionName​(@Nullable
                                                               @Nullable String dataRegionName)
        Sets a name of DataRegionConfiguration for this cache.
        Parameters:
        dataRegionName - DataRegionConfiguration name. Can be null (default DataRegionConfiguration will be used) but should not be empty.
        Returns:
        this for chaining.
      • getEvictionPolicy

        @Deprecated
        @Nullable
        public @Nullable EvictionPolicy<K,​V> getEvictionPolicy()
        Deprecated.
        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.
      • getEvictionPolicyFactory

        @Nullable
        public @Nullable javax.cache.configuration.Factory<EvictionPolicy<? super K,​? super V>> getEvictionPolicyFactory()
        Gets cache eviction policy factory. By default, returns null which means that evictions are disabled for cache.
        Returns:
        Cache eviction policy factory or null if evictions should be disabled or if getEvictionPolicy() should be used instead.
      • setEvictionPolicyFactory

        public CacheConfiguration<K,​V> setEvictionPolicyFactory​(@Nullable
                                                                      @Nullable javax.cache.configuration.Factory<? extends EvictionPolicy<? super K,​? super V>> evictPlcFactory)
        Sets cache eviction policy factory. Note: Eviction policy factory should be Serializable.
        Parameters:
        evictPlcFactory - Cache eviction policy factory.
        Returns:
        this for chaining.
      • isOnheapCacheEnabled

        public boolean isOnheapCacheEnabled()
        Checks if the on-heap cache is enabled for the off-heap based page memory.
        Returns:
        On-heap cache enabled flag.
      • setOnheapCacheEnabled

        public CacheConfiguration<K,​V> setOnheapCacheEnabled​(boolean onheapCache)
        Configures on-heap cache for the off-heap based page memory.
        Parameters:
        onheapCache - True if on-heap cache should be enabled.
        Returns:
        this for chaining.
      • isSqlOnheapCacheEnabled

        public boolean isSqlOnheapCacheEnabled()
        Gets whether SQL on-heap cache is enabled. When enabled, Ignite will cache SQL rows as they are accessed by query engine. Rows are invalidated and evicted from cache when relevant cache entry is either changed or evicted.
        Returns:
        Whether SQL onheap cache is enabled.
      • setSqlOnheapCacheEnabled

        public CacheConfiguration<K,​V> setSqlOnheapCacheEnabled​(boolean sqlOnheapCache)
        Sets whether SQL on-heap cache is enabled. When enabled, Ignite will cache SQL rows as they are accessed by query engine. Rows are invalidated and evicted from cache when relevant cache entry is either changed or evicted.
        Parameters:
        sqlOnheapCache - Whether SQL onheap cache is enabled.
        Returns:
        this for chaining.
      • getSqlOnheapCacheMaxSize

        public int getSqlOnheapCacheMaxSize()
        Gets maximum SQL on-heap cache. Measured in number of rows. When maximum size is reached oldest cached rows will be evicted.

        Zero or negative value stand for unlimited size.

        Defaults to DFLT_SQL_ONHEAP_CACHE_MAX_SIZE.

        Returns:
        SQL on-heap cache max size.
      • setSqlOnheapCacheMaxSize

        public CacheConfiguration<K,​V> setSqlOnheapCacheMaxSize​(int sqlOnheapCacheMaxSize)
        Sets maximum SQL on-heap cache. Measured in number of rows. When maximum size is reached oldest cached rows will be evicted.

        Zero or negative value stand for unlimited size.

        Defaults to DFLT_SQL_ONHEAP_CACHE_MAX_SIZE.

        Parameters:
        sqlOnheapCacheMaxSize - Maximum SQL on-heap cache.
        Returns:
        this for chaining.
      • setNearConfiguration

        public CacheConfiguration<K,​V> setNearConfiguration​(NearCacheConfiguration<K,​V> nearCfg)
        Sets the near cache configuration to use on all cache nodes.
        Parameters:
        nearCfg - Near cache configuration.
        Returns:
        this for chaining.
      • getPlatformCacheConfiguration

        public PlatformCacheConfiguration getPlatformCacheConfiguration()
        Gets platform cache configuration.
        Returns:
        Platform cache configuration or null.
      • setPlatformCacheConfiguration

        public CacheConfiguration<K,​V> setPlatformCacheConfiguration​(PlatformCacheConfiguration platformCfg)
        Sets platform cache configuration. Enables native platform (only .NET currently) cache when not null. Cache entries will be stored in deserialized form in native platform memory (e.g. .NET objects in CLR heap).

        When enabled on server nodes, all primary keys will be stored in platform memory as well.

        Same eviction policy applies to near cache entries for all keys on client nodes and non-primary keys on server nodes.

        Enabling this can greatly improve performance for key-value operations and scan queries, at the expense of RAM usage.

        Parameters:
        platformCfg - Platform 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.
      • 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<K,​V> 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.
      • setEvictionFilter

        public CacheConfiguration<K,​V> 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. If there is at least one cache configured with this flag set to true, Ignite will create a single thread to clean up expired entries in background. When flag is 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<K,​V> 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()
      • 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<K,​V> setCacheStoreFactory​(javax.cache.configuration.Factory<? extends CacheStore<? super K,​? super V>> storeFactory)
        Sets factory for persistent storage for cache data.
        Parameters:
        storeFactory - Cache store factory.
        Returns:
        this for chaining.
      • isStoreKeepBinary

        public Boolean isStoreKeepBinary()
        Flag indicating that CacheStore implementation is working with binary objects instead of Java objects. Default value of this flag is DFLT_STORE_KEEP_BINARY.

        If set to false, Ignite will deserialize keys and values stored in binary format before they are passed to cache store.

        Note that setting this flag to false can simplify store implementation in some cases, but it can cause performance degradation due to additional serializations and deserializations of binary objects. You will also need to have key and value classes on all nodes since binary will be deserialized when store is called.

        Returns:
        Keep binary in store flag.
      • setStoreKeepBinary

        public CacheConfiguration<K,​V> setStoreKeepBinary​(boolean storeKeepBinary)
        Sets keep binary in store flag.
        Parameters:
        storeKeepBinary - Keep binary in store flag.
        Returns:
        this for chaining.
      • getStoreConcurrentLoadAllThreshold

        public int getStoreConcurrentLoadAllThreshold()
        Gets the threshold used in cases when values for multiple keys are being loaded from an underlying CacheStore in parallel. In the situation when several threads load the same or intersecting set of keys and the total number of keys to load is less or equal to this threshold then there will be no a second call to the storage in order to load a key from thread A if the same key is already being loaded by thread B. The threshold should be controlled wisely. On the one hand if it's set to a big value then the interaction with a storage during the load of missing keys will be minimal. On the other hand the big value may result in significant performance degradation because it is needed to check for every key whether it's being loaded or not. When not set, default value is DFLT_CONCURRENT_LOAD_ALL_THRESHOLD.
        Returns:
        The concurrent load-all threshold.
      • setStoreConcurrentLoadAllThreshold

        public CacheConfiguration<K,​V> setStoreConcurrentLoadAllThreshold​(int storeConcurrentLoadAllThreshold)
        Sets the concurrent load-all threshold used for cases when keys' values are being loaded from CacheStore in parallel.
        Parameters:
        storeConcurrentLoadAllThreshold - The concurrent load-all threshold.
        Returns:
        this for chaining.
      • 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<K,​V> 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.PARTITIONED mode will be used by default (defined by DFLT_CACHE_MODE constant).
        Returns:
        True if cache is local.
      • setCacheMode

        public CacheConfiguration<K,​V> setCacheMode​(CacheMode cacheMode)
        Sets caching mode.
        Parameters:
        cacheMode - Caching mode.
        Returns:
        this for chaining.
      • setAtomicityMode

        public CacheConfiguration<K,​V> setAtomicityMode​(CacheAtomicityMode atomicityMode)
        Sets cache atomicity mode.
        Parameters:
        atomicityMode - Cache atomicity 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<K,​V> 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

        @Deprecated
        public long getDefaultLockTimeout()
        Deprecated.
        Default lock timeout configuration property has no effect.
        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

        @Deprecated
        public CacheConfiguration<K,​V> setDefaultLockTimeout​(long dfltLockTimeout)
        Deprecated.
        Default lock timeout configuration property has no effect.
        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<K,​V> 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.
      • setTransactionManagerLookupClassName

        @Deprecated
        public CacheConfiguration<K,​V> 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<K,​V> setRebalanceMode​(CacheRebalanceMode rebalanceMode)
        Sets cache rebalance mode.
        Parameters:
        rebalanceMode - Rebalance mode.
        Returns:
        this for chaining.
      • 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. Note that caches with SYNC rebalancing mode are always rebalanced prior to caches with ASYNC rebalancing mode when rebalancing order is the same.

        The rebalance order guarantees that rebalancing for this cache will start only when rebalancing for all caches with smaller rebalance order will be completed.

        If not set, cache order is 0.

        Returns:
        Cache rebalance order.
      • setRebalanceOrder

        public CacheConfiguration<K,​V> setRebalanceOrder​(int rebalanceOrder)
        Sets cache rebalance order.
        Parameters:
        rebalanceOrder - Cache rebalance order.
        Returns:
        this for chaining.
        See Also:
        getRebalanceOrder()
      • getRebalanceBatchSize

        @Deprecated
        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.
      • getRebalanceBatchesPrefetchCount

        @Deprecated
        public long getRebalanceBatchesPrefetchCount()
        To gain better rebalancing performance supplier node can provide more than one batch at rebalancing start and provide one new to each next demand request. Gets number of batches generated by supply node at rebalancing start. Minimum is 1.
        Returns:
        batches count
      • setRebalanceBatchesPrefetchCount

        @Deprecated
        public CacheConfiguration<K,​V> setRebalanceBatchesPrefetchCount​(long rebalanceBatchesCnt)
        To gain better rebalancing performance supplier node can provide more than one batch at rebalancing start and provide one new to each next demand request. Sets number of batches generated by supply node at rebalancing start. Minimum is 1.
        Parameters:
        rebalanceBatchesCnt - batches count.
        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<K,​V> 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()
      • getSqlIndexMaxInlineSize

        public int getSqlIndexMaxInlineSize()
        Gets maximum inline size for sql indexes. If -1 returned then IgniteSystemProperties.IGNITE_MAX_INDEX_PAYLOAD_SIZE system property is used.

        If not set, default value is DFLT_SQL_INDEX_MAX_INLINE_SIZE.

        Returns:
        Maximum payload size for offheap indexes.
      • setSqlIndexMaxInlineSize

        public CacheConfiguration<K,​V> setSqlIndexMaxInlineSize​(int sqlIdxMaxInlineSize)
        Sets maximum inline size for sql indexes.
        Parameters:
        sqlIdxMaxInlineSize - Maximum inline size for sql indexes.
        Returns:
        this for chaining.
      • 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<K,​V> 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<K,​V> 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<K,​V> setWriteBehindFlushFrequency​(long writeBehindFlushFreq)
        Sets write-behind flush frequency.
        Parameters:
        writeBehindFlushFreq - Write-behind flush frequency in milliseconds.
        Returns:
        this for chaining.
        See Also:
        getWriteBehindFlushFrequency()
      • setWriteBehindFlushThreadCount

        public CacheConfiguration<K,​V> 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<K,​V> setWriteBehindBatchSize​(int writeBehindBatchSize)
        Sets maximum batch size for write-behind cache.
        Parameters:
        writeBehindBatchSize - Maximum batch size.
        Returns:
        this for chaining.
        See Also:
        getWriteBehindBatchSize()
      • getWriteBehindCoalescing

        public boolean getWriteBehindCoalescing()
        Write coalescing flag for write-behind cache store operations. Store operations (get or remove) with the same key are combined or coalesced to single, resulting operation to reduce pressure to underlying cache store.

        If not provided, default value is DFLT_WRITE_BEHIND_COALESCING.

        Returns:
        Write coalescing flag.
      • setWriteBehindCoalescing

        public CacheConfiguration<K,​V> setWriteBehindCoalescing​(boolean writeBehindCoalescing)
        Sets write coalescing flag for write-behind cache.
        Parameters:
        writeBehindCoalescing - Write coalescing flag.
        Returns:
        this for chaining.
        See Also:
        getWriteBehindCoalescing()
      • getRebalanceDelay

        @Deprecated
        public long getRebalanceDelay()
        Deprecated.
        Use baseline topology feature instead. Please, be aware this API will be removed in the next releases.
        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 IgniteConfiguration.setConsistentId(Serializable) 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

        @Deprecated
        public CacheConfiguration<K,​V> setRebalanceDelay​(long rebalanceDelay)
        Deprecated.
        Use baseline topology feature instead. Please, be aware this API will be removed in the next releases.
        Sets rebalance delay (see getRebalanceDelay() for more information).
        Parameters:
        rebalanceDelay - Rebalance delay to set.
        Returns:
        this for chaining.
      • getRebalanceThrottle

        @Deprecated
        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

        @Deprecated
        public CacheConfiguration<K,​V> 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<K,​V> 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.
      • getMaxQueryIteratorsCount

        public int getMaxQueryIteratorsCount()
        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.
      • setMaxQueryIteratorsCount

        public CacheConfiguration<K,​V> setMaxQueryIteratorsCount​(int maxQryIterCnt)
        Sets maximum number of query iterators that can be stored.
        Parameters:
        maxQryIterCnt - Maximum number of query iterators that can be stored.
        Returns:
        this for chaining.
      • getInterceptor

        @Nullable
        public @Nullable CacheInterceptor<K,​V> getInterceptor()
        Gets cache interceptor.
        Returns:
        Cache interceptor.
      • setInterceptor

        public CacheConfiguration<K,​V> setInterceptor​(CacheInterceptor<K,​V> interceptor)
        Sets cache interceptor.
        Parameters:
        interceptor - Cache interceptor.
        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<K,​V> 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 the flag indicating whether a copy of the value stored in the on-heap cache (see isOnheapCacheEnabled() should be created for a cache operation return the value. Also if this flag is set copies are created for values passed to CacheInterceptor and to CacheEntryProcessor. If the on-heap cache is disabled then this flag is of no use.
        Returns:
        Copy on read flag.
      • setCopyOnRead

        public CacheConfiguration<K,​V> setCopyOnRead​(boolean cpOnRead)
        Sets copy on read flag.
        Parameters:
        cpOnRead - Copy on get flag.
        Returns:
        this for chaining.
        See Also:
        isCopyOnRead()
      • setSqlFunctionClasses

        public CacheConfiguration<K,​V> 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 @Nullable Class<?>[] getSqlFunctionClasses()
        Gets classes with methods annotated by QuerySqlFunction to be used as user-defined functions from SQL queries.
        Returns:
        Classes with SQL functions.
      • getQueryDetailMetricsSize

        public int getQueryDetailMetricsSize()
        Gets size of queries detail metrics that will be stored in memory for monitoring purposes. If 0 then history will not be collected. Note, larger number may lead to higher memory consumption.
        Returns:
        Maximum number of query metrics that will be stored in memory.
      • setQueryDetailMetricsSize

        public CacheConfiguration<K,​V> setQueryDetailMetricsSize​(int qryDetailMetricsSz)
        Sets size of queries detail metrics that will be stored in memory for monitoring purposes.
        Parameters:
        qryDetailMetricsSz - Maximum number of latest queries metrics that will be stored in memory.
        Returns:
        this for chaining.
      • getSqlSchema

        @Nullable
        public @Nullable String getSqlSchema()
        Gets custom name of the sql schema. If custom sql schema is not set then null will be returned and quoted case sensitive name will be used as sql schema.
        Returns:
        Schema name for current cache according to SQL ANSI-99. Could be null.
      • setSqlSchema

        public CacheConfiguration<K,​V> setSqlSchema​(String sqlSchema)
        Sets sql schema to be used for current cache. This name will correspond to SQL ANSI-99 standard. Nonquoted identifiers are not case sensitive. Quoted identifiers are case sensitive.

        Be aware of using the same string in case sensitive and case insensitive manner simultaneously, since behaviour for such case is not specified.

        When sqlSchema is not specified, quoted cacheName is used instead.

        sqlSchema could not be an empty string. Has to be "\"\"" instead.

        Parameters:
        sqlSchema - Schema name for current cache according to SQL ANSI-99. Should not be null.
        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<K,​V> 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<K,​V> 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.
      • getPluginConfigurations

        public CachePluginConfiguration[] getPluginConfigurations()
        Gets array of cache plugin configurations.
        Returns:
        Cache plugin configurations.
      • setPluginConfigurations

        public CacheConfiguration<K,​V> setPluginConfigurations​(CachePluginConfiguration... pluginCfgs)
        Sets cache plugin configurations.
        Parameters:
        pluginCfgs - Cache plugin configurations.
        Returns:
        this for chaining.
      • getQueryEntities

        public Collection<QueryEntity> getQueryEntities()
        Gets a collection of configured query entities.
        Returns:
        Query entities configurations.
      • getPartitionLossPolicy

        public PartitionLossPolicy getPartitionLossPolicy()
        Gets partition loss policy. This policy defines how Ignite will react to a situation when all nodes for some partition leave the cluster.
        Returns:
        Partition loss policy.
        See Also:
        PartitionLossPolicy
      • setPartitionLossPolicy

        public CacheConfiguration<K,​V> setPartitionLossPolicy​(PartitionLossPolicy partLossPlc)
        Sets partition loss policy. This policy defines how Ignite will react to a situation when all nodes for some partition leave the cluster.
        Parameters:
        partLossPlc - Partition loss policy.
        Returns:
        this for chaining.
        See Also:
        PartitionLossPolicy
      • setQueryEntities

        public CacheConfiguration<K,​V> setQueryEntities​(Collection<QueryEntity> qryEntities)
        Sets query entities configuration.
        Parameters:
        qryEntities - Query entities.
        Returns:
        this for chaining.
      • clearQueryEntities

        public CacheConfiguration<K,​V> clearQueryEntities()
        Clear query entities.
        Returns:
        this for chaining.
      • getQueryParallelism

        public int getQueryParallelism()
        Defines a hint to query execution engine on desired degree of parallelism within a single node. Query executor may or may not use this hint depending on estimated query costs. Query executor may define certain restrictions on parallelism depending on query type and/or cache type.

        As of Apache Ignite 1.9 this hint is only supported for SQL queries with the following restrictions:

        • All caches participating in query must have the same degree of parallelism, exception is thrown otherwise
        • All queries on the given cache will follow provided degree of parallelism
        These restrictions will be removed in future versions of Apache Ignite.

        Defaults to DFLT_QUERY_PARALLELISM.

        Returns:
        Query parallelism.
      • setQueryParallelism

        public CacheConfiguration<K,​V> setQueryParallelism​(int qryParallelism)
        Sets query parallelism.
        Parameters:
        qryParallelism - Query parallelism.
        Returns:
        this for chaining.
        See Also:
        getQueryParallelism()
      • getCacheStoreSessionListenerFactories

        public javax.cache.configuration.Factory<? extends CacheStoreSessionListener>[] getCacheStoreSessionListenerFactories()
        Gets cache store session listener factories.
        Returns:
        Cache store session listener factories.
        See Also:
        CacheStoreSessionListener
      • getCacheEntryListenerConfigurations

        public Iterable<javax.cache.configuration.CacheEntryListenerConfiguration<K,​V>> getCacheEntryListenerConfigurations()
        Specified by:
        getCacheEntryListenerConfigurations in interface javax.cache.configuration.CompleteConfiguration<K,​V>
        Overrides:
        getCacheEntryListenerConfigurations in class javax.cache.configuration.MutableConfiguration<K,​V>
      • addCacheEntryListenerConfiguration

        public javax.cache.configuration.MutableConfiguration<K,​V> addCacheEntryListenerConfiguration​(javax.cache.configuration.CacheEntryListenerConfiguration<K,​V> cacheEntryLsnrCfg)
        Overrides:
        addCacheEntryListenerConfiguration in class javax.cache.configuration.MutableConfiguration<K,​V>
      • removeCacheEntryListenerConfiguration

        public javax.cache.configuration.MutableConfiguration<K,​V> removeCacheEntryListenerConfiguration​(javax.cache.configuration.CacheEntryListenerConfiguration<K,​V> cacheEntryLsnrCfg)
        Overrides:
        removeCacheEntryListenerConfiguration in class javax.cache.configuration.MutableConfiguration<K,​V>
      • writeReplace

        protected Object writeReplace()
        Creates a copy of current configuration and removes all cache entry listeners. They are executed only locally and should never be sent to remote nodes.
        Returns:
        Configuration object that will be serialized.
      • setStatisticsEnabled

        public CacheConfiguration<K,​V> setStatisticsEnabled​(boolean enabled)
        Overrides:
        setStatisticsEnabled in class javax.cache.configuration.MutableConfiguration<K,​V>
      • setManagementEnabled

        public CacheConfiguration<K,​V> setManagementEnabled​(boolean enabled)
        Overrides:
        setManagementEnabled in class javax.cache.configuration.MutableConfiguration<K,​V>
      • setCacheLoaderFactory

        public CacheConfiguration<K,​V> setCacheLoaderFactory​(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheLoader<K,​V>> factory)
        Overrides:
        setCacheLoaderFactory in class javax.cache.configuration.MutableConfiguration<K,​V>
      • setCacheWriterFactory

        public CacheConfiguration<K,​V> setCacheWriterFactory​(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheWriter<? super K,​? super V>> factory)
        Overrides:
        setCacheWriterFactory in class javax.cache.configuration.MutableConfiguration<K,​V>
      • setExpiryPolicyFactory

        public CacheConfiguration<K,​V> setExpiryPolicyFactory​(javax.cache.configuration.Factory<? extends javax.cache.expiry.ExpiryPolicy> factory)
        Overrides:
        setExpiryPolicyFactory in class javax.cache.configuration.MutableConfiguration<K,​V>
      • setTypes

        public CacheConfiguration<K,​V> setTypes​(Class<K> keyType,
                                                      Class<V> valType)
        Overrides:
        setTypes in class javax.cache.configuration.MutableConfiguration<K,​V>
      • setReadThrough

        public CacheConfiguration<K,​V> setReadThrough​(boolean isReadThrough)
        Overrides:
        setReadThrough in class javax.cache.configuration.MutableConfiguration<K,​V>
      • setWriteThrough

        public CacheConfiguration<K,​V> setWriteThrough​(boolean isWriteThrough)
        Overrides:
        setWriteThrough in class javax.cache.configuration.MutableConfiguration<K,​V>
      • setStoreByValue

        public CacheConfiguration<K,​V> setStoreByValue​(boolean isStoreByVal)
        Overrides:
        setStoreByValue in class javax.cache.configuration.MutableConfiguration<K,​V>
      • isEventsDisabled

        public Boolean isEventsDisabled()
        Checks whether events are disabled for this cache.
        Returns:
        Events disabled flag.
      • setEventsDisabled

        public CacheConfiguration<K,​V> setEventsDisabled​(boolean evtsDisabled)
        Sets events disabled flag.
        Parameters:
        evtsDisabled - Events disabled flag.
        Returns:
        this for chaining.
      • getKeyConfiguration

        public CacheKeyConfiguration[] getKeyConfiguration()
        Gets cache key configuration.
        Returns:
        Cache key configuration.
      • setKeyConfiguration

        public CacheConfiguration<K,​V> setKeyConfiguration​(CacheKeyConfiguration... cacheKeyCfg)
        Sets cache key configuration.
        Parameters:
        cacheKeyCfg - Cache key configuration.
        Returns:
        this for chaining.
      • isEncryptionEnabled

        public boolean isEncryptionEnabled()
        Gets flag indicating whether data must be encrypted.
        Returns:
        True if this cache persistent data is encrypted.
      • setEncryptionEnabled

        public CacheConfiguration<K,​V> setEncryptionEnabled​(boolean encryptionEnabled)
        Sets encrypted flag.
        Parameters:
        encryptionEnabled - True if this cache persistent data should be encrypted.
        Returns:
        this for chaining.
      • getDiskPageCompressionLevel

        public Integer getDiskPageCompressionLevel()
        Gets algorithm specific disk page compression level.
        Returns:
        Disk page compression level or null for default.
      • setDiskPageCompressionLevel

        public CacheConfiguration<K,​V> setDiskPageCompressionLevel​(Integer diskPageCompressionLevel)
        Sets algorithm specific disk page compression level.
        Parameters:
        diskPageCompressionLevel - Disk page compression level or null to use default. Zstd: from -131072 to 22 (default 3). LZ4: from 0 to 17 (default 0).
        Returns:
        this for chaining.