Redis command details
Redis command details
1. set setnx setex
Set 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 LPUSHX
Lpush 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, and a false will be returned. [the same is true for rpushx]
3. LRANGE LINDEX
Lrange returns the elements in the specified range in the list key. The range is specified by 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.
Then, if it is 0-1, it indicates from 0th to the first to the last. If it is 0-2, it is 0 to the second to the last.
Lindex returns the index element of the list subscript, also 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.
Install and test Redis in Ubuntu 14.04
Redis cluster details
Install Redis in Ubuntu 12.10 (graphic explanation) + Jedis to connect to Redis
Redis series-installation, deployment, and maintenance
Install Redis in CentOS 6.3
Learning notes on Redis installation and deployment
Redis. conf
Redis details: click here
Redis: click here
This article permanently updates the link address: