0 votes
in MemCached by
How to replace the value of the key?

1 Answer

0 votes
by

By using replace command, you can replace the value of the key.

Syntax

  1. replace key flags exptime bytes [noreply]  
  2. 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".

  1. add key 0 900 9  
  2. memcached  
  3. STORED  
  4. get key  
  5. VALUE key 0 9  
  6. memcached  
  7. END  
  8. replace key 0 900 5  
  9. redis  
  10. get key  
  11. VALUE key 0 5  
  12. redis  
  13. END  

Related questions

0 votes
asked Jun 15, 2022 in MemCached by sharadyadav1986
0 votes
asked Jul 29, 2023 in MemCached by sharadyadav1986
...