Redis 4: List type of storage types

Source: Internet
Author: User
1. lpush num 0 1 2 3 4 5 6 7 8 9 10 in turn push from left to 0-102. rpush num 0 1 2 3 4 5 6 7 8 9 10 in turn push from the right to 0-103. lrnage num 0-1 show all data in the num list result: 10 9 8 7 6 5 4 3 2 1 0 1 2 4 5 6 7 8 9 104. lpop num is deleted from the left and an element is displayed. rpop num is deleted from the right side and an element 6 is displayed. llen num to obtain the number of elements 7. lrange num 0 2 get 3 8 from left. lrange num-3-1 get 3 9 from right. lrem num 0 100 delete all elements with a value of 100 from the num list, for example, 100 0 2 3 40 50 100 658 100 65810 result: 0 2 3 40 50. lrem num-2 100 from num Column In the table, delete two elements with 100 values from the left to the right, for example, 100 0 2 3 40 50 100 658 100 result: 100 0 2 3 40 50 65811. lrem num 2 100 from the num list, delete two elements from the left to the right with a value of 100, for example, 100 0 2 3 40 50 100 658 100 result: 0 2 3 40 50 658 10013.set num 8 20 set the index with the value of 8 in the num list to 2012. lindex num 8 obtains the index value of 8 in the num list. 13. ltrim takes the value of a certain range (relative to lrange), ltrim deletes all ltrim num 0 2 except these ranges, for example: 100 0 2 3 40 50 100 658 100 result: 3 40 50 100 658 10014. linsert num before | the value of alfter 658 888 to num list is 65. After 8, an element (Before) with a value of 888 is inserted, for example, 100 0 2 3 40 100 658 100 100. Result: 100 2 3 40 50 658 888 10015. rpoplpush num as its name implies: push from the right to the left (in this example, the num to the num list can actually be different from the list). For example: 100 200 300 execute the result once: 300 100 200 execution result: 200 300 100 execution time: 100 200 300 Haha ^__^ return to the starting point! I don't know what it means !!!
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.