Este conteúdo não está disponível no idioma selecionado.
2.3. Using the Batching API
2.3.1. Configure the Batching API Copiar o linkLink copiado para a área de transferência!
To configure the Batching API in the XML file, the transactionMode
must be TRANSACTIONAL
to enable invocationBatching
:
<transaction transactionMode="TRANSACTIONAL"> <invocationBatching enabled="true" />
<transaction transactionMode="TRANSACTIONAL">
<invocationBatching enabled="true" />
To configure the Batching API programmatically use:
Configuration c = new ConfigurationBuilder().transaction().transactionMode(TransactionMode.TRANSACTIONAL).invocationBatching().enable().build();
Configuration c = new ConfigurationBuilder().transaction().transactionMode(TransactionMode.TRANSACTIONAL).invocationBatching().enable().build();
Note
2.3.2. Use the Batching API Copiar o linkLink copiado para a área de transferência!
startBatch()
and endBatch()
on the cache as follows to use batching:
Cache cache = cacheManager.getCache();
Cache cache = cacheManager.getCache();
Example 2.2. Without Using Batch
cache.put("key", "value");
cache.put("key", "value");
cache.put(key, value);
line executes, the values are replaced immediately.
Example 2.3. Using Batch
cache.endBatch(true
);
executes, all modifications made since the batch started are replicated.
cache.endBatch(false
);
executes, changes made in the batch are discarded.
2.3.3. Batching API Usage Example Copiar o linkLink copiado para a área de transferência!
Example 2.4. Batching API Usage Example