Python-redis list mode

Source: Internet
Author: User

Store data in the list advanced (left-forward)

Lpush names A B C D E

Store Data LIFO (right-forward) in the list

Rpush names G P H K

To view the data in the list:

Lrange names 0 (starting from 0)-1

Slice:

Lrange names start end (start end stands for starting and ending positions)

Insert:

Linsert names Before/after D (where the benchmark is plugged in) TEST

Modify:

LSet Names 3 Xiaopang

Delete:

Lrem Name 3 Xiaopang

To remove from the left side of the list:

Lpop names

In addition to subscript 1-2 other data is removed:

LTRIM names 1 2 (subscript position)

Names the last data, insert the first position into the Names2:

Rpoplpush names Names2

To delete list data:

Blpop names 4 (no data will wait 4 seconds, the data will be displayed, waiting for the time can continue to put data)

Python-redis list mode

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.