May 17, 2021 Memcached
The Memcached replace command replaces the value of the key (key) that already exists.
If key does not exist, the replacement fails and you will get a response NOT_STORED .
The basic syntax of the replace command is as follows:
replace key flags exptime bytes [noreply] value
The parameters are described below:
In the following example we set:
In the following example we use the key bit 'mykey' and store the corresponding value data_value. After execution we replace the value of the same key as 'some_other_value'.
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
If the data is added successfully, the output:
STORED
Output information description: