Cache Configuration
How to set GridGain cache configuration parameters, with a configuration example, the full parameter reference, and cache templates.
This chapter explains how you can set cache configuration parameters. Once a cache is created, you cannot change its configuration parameters.
Configuration Example
Below is an example of a cache configuration.
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="cacheConfiguration">
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="myCache"/>
<property name="cacheMode" value="PARTITIONED"/>
<property name="backups" value="2"/>
<property name="rebalanceMode" value="SYNC"/>
<property name="writeSynchronizationMode" value="FULL_SYNC"/>
<property name="partitionLossPolicy" value="READ_ONLY_SAFE"/>
<!-- Other parameters -->
</bean>
</property>
</bean>For the full list of parameters, refer to the CacheConfiguration javadoc.
name
The cache name.
None.
cacheMode
The cacheMode parameter defines the way data is distributed in the cluster.
In the PARTITIONED mode (default), the overall data set is divided into partitions and all partitions are split between participating nodes in a balanced manner.
In the REPLICATED mode, all the data is replicated to every node in the cluster.
See the Partitioned/Replicated Mode section for more details.
PARTITIONED
writeSynchronizationMode
Write synchronization mode. Refer to the Configuring Partition Backups section.
PRIMARY_SYNC
rebalanceMode
This parameter controls the way the rebalancing process is performed. Possible values include:
SYNC -- Any requests to the cache's API are blocked until rebalancing is completed.
ASYNC (default) -- Rebalancing is performed in the background.
NONE -- Rebalancing is not triggered.
ASYNC
readFromBackup
Read requested cache entry from the backup partition if it is available on the local node instead of making a request to the primary partition (which can be located on the remote nodes). Note: This property doesn't work with SQL joins.
true
queryParallelism
The number of threads in a single node to process a SQL query executed on the cache. Refer to the Query Parallelism section in the Performance guide for more information.
1
For the full list of parameters, refer to the CacheConfiguration javadoc.
name
The cache name.
None.
cacheMode
The cacheMode parameter defines the way data is distributed in the cluster.
In the PARTITIONED mode (default), the overall data set is divided into partitions and all partitions are split between participating nodes in a balanced manner.
In the REPLICATED mode, all the data is replicated to every node in the cluster.
See the Partitioned/Replicated Mode section for more details.
PARTITIONED
writeSynchronizationMode
Write synchronization mode. Refer to the Configuring Partition Backups section.
PRIMARY_SYNC
rebalanceMode
This parameter controls the way the rebalancing process is performed. Possible values include:
SYNC -- Any requests to the cache's API are blocked until rebalancing is completed.
ASYNC (default) -- Rebalancing is performed in the background.
NONE -- Rebalancing is not triggered.
ASYNC
readFromBackup
Read requested cache entry from the backup partition if it is available on the local node instead of making a request to the primary partition (which can be located on the remote nodes). Note: This property doesn't work with SQL joins.
true
queryParallelism
The number of threads in a single node to process a SQL query executed on the cache. Refer to the Query Parallelism section in the Performance guide for more information.
1
For the full list of parameters, refer to the CREATE TABLE section.
unsupported
Cache Templates
A cache template is an instance of CacheConfiguration that can be registered in the cluster and used later as a basis for creating new caches or SQL tables. A cache or table created from a template inherits all the properties of the template.
Templates can be used in many contexts: on servers, clients (thin and thick), in SQL (e.g., CREATE TABLE), in commands such as createCache and getOrCreateCache, as well as in the REST API calls. For example, thin clients and SQL do not support some cache configuration properties, and cache templates can be used to work around this limitation.
To create a template, define a cache configuration and add it to the Ignite instance, as shown below. If you want do define a cache template in the XML configuration file, you must add an asterisk to the template's name. This is required to indicate that the configuration is a template and not an actual cache.
unsupported
Once the cache template is registered in the cluster, as shown in the code snippet above, you can use it to create another cache with the same configuration.
This page is: Copyright © 2026 MariaDB. All rights reserved.
Last updated
Was this helpful?

