Redis command details

Source: Internet
Author: User
Tags redis cluster install redis

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:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.