Memcached Replace Operation with Python Examples

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/memcached-replace-operation-python-examples/
PINTEREST
PINTEREST
INSTAGRAM

Replace operation will change existing key-value. If the key-value do not exists we will get an response like NOT_STORED. Its syntax is similar to add.

  • replace is the name of the verb
  • key the key which replaced
  • flag as flag
  • expiretime  the time range the key-value stored in memcached
  • bytes  the size of the new value
  • value new value

Let’s add new data  and check it exists.

We will replace poftut key-value with new value.

  • replace  the verb
  • poftut  is the key we want to replace its data
  • flags
  • 100 the second we want to hold new key-value
  • is the size of new value
  • testnew  is new value
  • STORED  the result of the successful replace operation

Python Application

We save the code as filename replace.py.After running the code the output we get.

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/memcached-replace-operation-python-examples/
PINTEREST
PINTEREST
INSTAGRAM

LEARN MORE  Memcache Delete Operation with Python Example

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)