By using replace command, you can replace the value of the key.
Syntax
- replace key flags exptime bytes [noreply]
- value
Example
In the given example, we use "key" as the key and add the value Memcached in it with 900 seconds expiration time. After this, the same key is replaced with the "redis".
- add key 0 900 9
- memcached
- STORED
- get key
- VALUE key 0 9
- memcached
- END
- replace key 0 900 5
- redis
- get key
- VALUE key 0 5
- redis
- END