Chapter 5. Return Values
5.1. About Return Values Copy linkLink copied to clipboard!
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 Copy linkLink copied to clipboard!
As a default in Red Hat JBoss Data Grid, the put() and remove() API operations return the original or previous values in the cache. However, if the original value was not required, this operation is wasteful.
To conserve the resources used, disable the return values. Note that this solution is only applicable for cache instances that only perform write operations (for example put() and remove()). Implement this solution as follows:
Procedure: Disable Return Values
Set the
IGNORE_RETURN_VALUESflag. 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_LOADflag. 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