--list List of Redis database operations under LUnix

Source: Internet
Author: User
Tags redis lunix

First, you need to understand the concepts of stacks and queues first:

Stack advanced after: The Bullets on the analogy magazine, the last bullet bullets first use, drywall brick, from behind

Queue FIFO: line up for rice, first come first served

To create a list:

Add to Left: (Stack form Add)

# Output: " 5 " " 4 " " 3 " " 2 " " 1 "

Right add: (added as queue)

Rpush List 1 2 3 4 5#  output:"1"2)  "2"3)  " 3 "4)  "4"5)  "5"

To view the list:

Lrange list 0-1   #  Index View  0 (first bit)-1 (last)

View Length:

Llen list   #  returns a number

View the specified element: (index)

# The   4th element is viewed here from the 0th bit

To delete an element:

Lpop list  #  Delete rpop List # from the left to    Delete from the right

Delete the specified number of elements:

Lrem List 3 (number) 5(Element)#  means to remove 3 ' 5 ' from the top of this element #  If it is-3 means to remove 3 ' 5 ' from the bottom of the element 

--list List of Redis database operations under LUnix

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.