Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Memcached gets command


May 17, 2021 Memcached



The Memcached gets command gets value (data value) with CAS token deposit, and returns empty if key does not exist.

Grammar:

The basic syntax format of the gets command is as follows:

gets key

Multiple keys are separated by spaces, as follows:

gets key1 key2 key3

The parameters are described below:

  • Key: Key in the key-value structure to find cached values.

Instance

In the following example, we use w3cschool as key, with an expiration time set to 900 seconds.

set w3cschool 0 900 9
memcached
STORED
gets w3cschool
VALUE w3cschool 0 9 1
memcached
END

In the output using the gets command, the number 1 in the last column represents a CAS token with key w3cschool.