Redis data Type-linked list (list)

Source: Internet
Author: User

1. List

  

Introduced:

List is a linked list structure, the main function is push, pop, get all the values of a range and so on, the operation of key is understood as the name of the list.
The Redis list type is actually a doubly linked list in which each child element is a string type.
We can add delete elements from the head or tail of the list by push, pop operations, so that the list can be both a stack and a queue.

Method:

1. Lpush add string element to the head of key corresponding list Lpush mylist "World" Lpush mylist "Hello" Lrange mylist 0-1 return to Hello World

2. Rpust adds a string element to the tail of key corresponding list Rpust mylist "World" Rpush mylist "Hello" Lrange mylist 0-1 return to Hello World

3. Linsert adds a string before or after key corresponds to a specific position in the list Rpush mylist3 "World" Linsert Mylist3 before "world" "Hello"

Redis data Type-linked list (list)

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.