Redis Database for 03_nosql database: list type

Source: Internet
Author: User



lists Type and Operation

Listis a linked list structure, the main function roomPush,pop, get all values of a range, and so on, in actionKeyunderstood as the name of the linked list. Redisof theListtype is actually one of each element isstringa doubly linked list of types. We can passPush,PopAction adds a delete element from the head or tail of the list, soListIt can be both a stack and a queue.

Lpush: in the Key corresponding List adds a string element to the header.

Rpush: in the Key corresponding to the List the tail of the add string element.

Linsert: in the Key corresponding List adds a string before or after a specific location.

LSet : Set List Specifies the value of the element in the subscript.

Lrem: from Key corresponding List deleted in N A and value the same element. (n <0 removed from tail,n=0 all deleted)

above the lrem mylist5 1 "Hello" represents a form of Mylist5 deleted in 1 A and Hello the same value.

The number returned above represents the number of deletions.

LTrim: Keep the specified Key data within the range of values.

For example: LTrim list8 1-1 indicates that the keep subscript is 1 to the value of the last element, the other elements are removed.

Lpop: from List The header removes the element and returns the deleted element.

Rpop list10

Lrange list10 0-1

Rpoplpush: from the first List the trailing element is removed and added to the second List 's head.

among them: Rpoplpush mylist5 Mylist6 The meaning of the expression is to Mylist5 the elements in the popup are given Mylist6.

then check Mylist5, found only one three , and then look at the Mylist6, There are three elements found, namely: Hello,hello,foo

lindex: returns the name of Key of the List in the Index the element of the position.

Llen : See how many elements are in a linked list

Redis Database for 03_nosql database: list type

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.