Latest web development tutorials

Memcached prepend command

Memcached prepend command to an existingkey (key) value (data value)additional data front.

grammar:

The basic syntax prepend command is as follows:

prepend key flags exptime bytes [noreply]
value

Parameters are as follows:

  • key: key key-value structure key, it is used to find the cache value.
  • flags: may include a key-value pair of integer parameter, the client uses it to store additional information about the key-value pairs.
  • exptime: save key-value pairs in the cache the length of time (in seconds, 0 means forever)
  • bytes: number of bytes stored in the cache
  • noreply (optional): This parameter tells the server does not need to return data
  • value: the value stored (always located in the second row) (can be directly understood as key-value structure value)

Examples

Examples are as follows:

  • First, we store a key w3big in Memcached, which is memcached.
  • We then use the get command to retrieve the value.
  • We then use the command appendprepend "redis" after the value of the key is w3big.
  • Finally, we'll use the get command to retrieve the value.
set w3big 0 900 9
memcached
STORED
get w3big
VALUE w3big 0 14
memcached
END
prepend w3big 0 900 5
redis
STORED
get w3big
VALUE w3big 0 14
redismemcached
END

Export

If the data is added successfully, the output:

STORED

Output information Description:

  • STORED: After successfully saved output.
  • NOT_STORED: The key on Memcached does not exist.
  • CLIENT_ERROR: execution error.