UK[rɪˈpleɪs] US[rɪˈples]

vt.Replace; replace; put... back into its original place; (with...) replace

Third person singular: replaces Present participle: replacing Past tense: replaced Past participle: replaced

memcached replace command syntax

Function: Used to replace the value (data value) of the existing key (key). If key does not exist, the replacement fails and you get the response NOT_STORED.

Syntax: replace key flags exptime bytes [noreply]value

Parameters:

ParametersDescription
keyKey value The key in the key-value structure is used to find the cache value.
#flagsCan include integer parameters of key-value pairs, which are used by the client to store additional information about the key-value pairs.
exptimeThe length of time (in seconds, 0 means forever) to keep key-value pairs in the cache.
bytesThe number of bytes stored in the cache.
noreplyOptional, this parameter tells the server that no data needs to be returned.
valueThe stored value (always located in the second line) (can be directly understood as the value in the key-value structure).

memcached replace command example

add mykey 0 900 10
data_value
STORED
get mykey
VALUE mykey 0 10
data_value
END
replace mykey 0 900 16
some_other_value
get mykey
VALUE mykey 0 16
some_other_value
END