The replace() methods update an existing
key/value pair in the database. If the specified key does not
exist, then the operation will fail.
| API Call | client.replace(key, expiry, value) | ||
| Asynchronous | yes | ||
| Description | Update an existing key with a new value | ||
| Returns | Future<Boolean> (
Asynchronous request value, as Boolean
) | ||
| Arguments | |||
String key | Document ID used to identify the value | ||
int expiry | Expiry time for key. Values larger than 30*24*60*60 seconds (30 days) are interpreted as absolute times (from the epoch). | ||
Object value | Value to be stored | ||
The first form of the replace() method
updates an existing value setting while supporting the explicit
setting of the expiry time on the item. For example to update the
samplekey:
OperationFuture<Boolean> replaceOp = client.replace("samplekey","updatedvalue",0);
The return value is a OperationFuture value
with a Boolean base.
| API Call | client.replace(key, expiry, value, transcoder) | ||
| Asynchronous | yes | ||
| Description | Update an existing key with a new value | ||
| Returns | Future<Boolean> (
Asynchronous request value, as Boolean
) | ||
| Arguments | |||
String key | Document ID used to identify the value | ||
int expiry | Expiry time for key. Values larger than 30*24*60*60 seconds (30 days) are interpreted as absolute times (from the epoch). | ||
Object value | Value to be stored | ||
Transcoder<T> transcoder | Transcoder class to be used to serialize value | ||
The second form of the replace() method
is identical o the first, but also supports using a custom
Transcoder in place of the default transcoder.