Redis command details, Redis command details

Source: Internet
Author: User

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. keyThe element in the specified range. The range is offset. startAnd 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.

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.