Memcached set command

The Memcached set command is used to store the value (data value) in the specified key (key) .

If the key of the set already exists, this command can update the original data corresponding to the key, that is, to achieve the function of updating

grammar:

The basic syntax of the set command is as follows:

set key flags exptime bytes [noreply]
value

 

The parameter description is as follows:

  • key: The key in the key-value structure, used to look up the cached value.
  • flags : An integer parameter that can include key-value pairs, which the client uses to store additional information about key-value pairs.
  • exptime : How long to keep key-value pairs in the cache (in seconds, 0 means forever)
  • bytes : the number of bytes to store in the cache
  • noreply (optional) : This parameter tells the server that no data should be returned
  • value : the stored value (always on the second line) (which can be directly understood as the value in the key-value structure)

Example

In the following example we set:

  • key → test
  • flag → 0
  • exptime → 900 (in seconds)
  • bytes → 9 (bytes of data storage)
  • value → testvalue
set runoob 0 900 9
memcached
STORED

get runoob
VALUE runoob 0 9
memcached

END

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326689503&siteId=291194637