[id='forcing-return-values_{context}']
= Forcing Return Values
To avoid sending data unnecessarily, write operations on remote caches return `null` instead of previous values.

For example, the following method calls do not return previous values for keys:

[source,java]
----
V remove(Object key);
V put(K key, V value);
----

You can, however, change the default behavior so your invocations return previous values for keys.

.Procedure

* Configure Hot Rod clients so method calls return previous values for keys in one of the following ways:

.FORCE_RETURN_VALUE flag
[source,java,options="nowrap",subs=attributes+,role="primary"]
----
include::code_examples/HotRodForceReturn.java[]
----

.Per-cache
[source,java,options="nowrap",subs=attributes+,role="secondary"]
----
include::code_examples/HotRodForceReturnPerCache.java[]
----

.hotrod-client.properties
[source,options="nowrap",subs=attributes+,role="secondary"]
----
# Use the "*" wildcard in the cache name to return previous values
# for all caches that start with the "somecaches" string.

infinispan.client.hotrod.cache.somecaches*.force_return_values = true
----

[role="_additional-resources"]
.Additional resources
* link:../../apidocs/org/infinispan/client/hotrod/Flag.html#FORCE_RETURN_VALUE[org.infinispan.client.hotrod.Flag]
