Memcached set command
The
If the set key already exists, this command can update the original data corresponding to the key, which is to achieve the update function.
Syntax:
The basic syntax format 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 is used to find cached values.
flags: Integer parameter that can include key-value pairs and is used by the client to store additional information about the key-value pairs .
exptime: The length of time to keep key-value pairs in the cache (in seconds, 0 means forever)
bytes: The number of bytes stored in the cache
noreply (optional) : This parameter tells the server that no data needs to be returned
value: The stored value (always located in the second line) (can be directly understood as the value in the key-value structure)
Example
In the following example we set:
key → php
flag → 0
exptime → 900 (in seconds)
bytes → 9 (number of bytes of data storage)
value → memcached
set php 0 900 9 memcached STORED get php VALUE php 0 9 memcached END
Output
If the data is set successfully, output:
STORED
Output information description:
STORED: Output after successful saving.
ERROR: Output after a hold failure.