Questo contenuto non è disponibile nella lingua selezionata.
Chapter 5. Return Values
5.1. About Return Values Copia collegamentoCollegamento copiato negli appunti!
Values returned by cache operations are referred to as return values. In Red Hat JBoss Data Grid, these return values remain reliable irrespective of which cache mode is employed and whether synchronous or asynchronous communication is used.
5.2. Disabling Return Values Copia collegamentoCollegamento copiato negli appunti!
- Library Mode
By default, in Library Mode, JBoss Data Grid returns previous values in the cache for
put()
andremove()
API operations.To conserve resources, you can disable these return values where you do not require them.
Use the
IGNORE_RETURN_VALUES
flag from theorg.infinispan.context.Flag
class as follows:Set the
IGNORE_RETURN_VALUES
flag. This flag signals that the operation’s return value is ignored. For example:cache.getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES)
cache.getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the
SKIP_CACHE_LOAD
flag. This flag does not load entries from any configured CacheStores. For example:cache.getAdvancedCache().withFlags(Flag.SKIP_CACHE_LOAD)
cache.getAdvancedCache().withFlags(Flag.SKIP_CACHE_LOAD)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For more information, see Flag.IGNORE_RETURN_VALUES
- Remote Client/Server Mode
By default, when remotely accessing caches in Server Mode, JBoss Data Grid disables return values so that
put()
andremove()
API operations do not return previous values in the cache.You can set the
FORCE_RETURN_VALUE
inorg.infinispan.client.hotrod.Flag
to return previous values forput()
andremove()
API operations. However, doing this adds performance costs through serialization and network requirements.For more information, see Flag.FORCE_RETURN_VALUE