redis view list list

[Command] lrange key start end: Get the value from start to end in the linked list, start starts from 0, like the following STATION1, the position of D is 0, the position of C is 1, and start and end can also be negative numbers. The position of the first-to-last element is -1, the second-to-last element is -2, and so on

so

[Key points] lrange key 0 -1 is to get from the first element to the last element, that is, to get all the elements, this command is often used.

[Example] If there are the following two lists

key               value

STATION1    [D,C,B,A]

STATION2    [a,b,c,d]

Want to get all elements of STATION1

       lrange STATION1 0 3

       lrange STATION1 0 -1

Want to get the 2nd to 3rd elements of STATION2, ie "b", "c"

       lrange STATION2 1 2

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325842413&siteId=291194637