Memcached Get Operation with Python Example

We store key-values all time but I belive that the time to get these values have came :). Now we will look how to get values by providing keys. The simplest syntax in memcached is get operation.

get key1 [key2] [key3]
  • get is the verb of the operation.
  • key1  is the key of the value we want to get
  • key2,key3,… are the keys we want to get. We can get multiple values with single get.
add poftut 0 100 4 
get poftut 
VALUE poftut 0 4 

As the first we add out key as we have learned before.

  • get is the verb of the operation
  • poftut is the key of the value
  • VALUE is value options like name flag size
  • test is the value we are looking for
  • END means transaction is successfully ended.

Python Application

import memcache 

When executed following output is given

$ python3 get 
{'poftut2': 'test'}

LEARN MORE  How To Delete and Remove File and Directory with Python?

Leave a Comment