Memcached prepend command
Memcached prepend command is used to append data in front of value(data value) that already exists key(key).
Syntax:
The basic syntax format of the prepend command is as follows:
prepend 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
The example is as follows:
First we store a key php in Memcached, and its value is memcached.
We then retrieve the value using the get command.
Then, we use the prepend command to append "redis" after the value with the key php.
Finally, we use the get command to retrieve the value.
set php 0 900 9 memcached STORED get php VALUE php 0 14 memcached END prepend php 0 900 5 redis STORED get php VALUE php 0 14 redismemcached END
Output
If the data is added successfully, output:
STORED
Output information description:
STORED: Output after successful saving.
NOT_STORED: The key does not exist on Memcached.
CLIENT_ERROR: Execution error.