Redis command details, Redis command details
1. set setnx setexset associates the value of the string value with the key. If the key already exists, it overwrites the original one. If it does not exist, it is created.
Setnx sets the key value as value. If the key does not exist, the setting fails if the key already exists.
SetEx is a key with a life cycle. We can find that the parameter order of setex is: key time value,
At the same time, it should be noted that, like setex and set, if the key does not exist, it will be created. If the key already exists, it will be overwritten.
I think we can refer to the following two Commands: expire and persist. One is to set the survival time for a key, and the other is the survival time for removing the key.
2. LPUSH LPUSHXlpush inserts one or more values into the header (left) of the key list [rpush is inserted to the right of the table at the end of the list]. Note that if the key does not exist, create an empty list and perform the lpush operation. Lpushx also inserts one or more values into the header of the key list, but if the key does not exist, nothing will happen. A false value is returned. [rpushx is the same.] 3. LRANGE LINDEXlrange returns the list.
key
The element in the specified range. The range is offset.
start
And
stop
. It is explained that the subscript of list starts with 0, followed by 1, 2, 3 ...... The last one is-1, the second is-2, and the third is-3. If it is 0-1, it indicates that from 0th to the first, if it is 0-2, it is the element from 0 to the penultimate Lindex that returns the index of list subscript. It is also the element of list subscript starting with 0, followed by 1, 2, 3 ...... The last one is-1, the second is-2, and the third is-3. If it is 0-1, it indicates that from 0th to the first, if it is 0-2, it is 0 to the second to the last.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.