lists Type and Operation
Listis a linked list structure, the main function roomPush,pop, get all values of a range, and so on, in actionKeyunderstood as the name of the linked list. Redisof theListtype is actually one of each element isstringa doubly linked list of types. We can passPush,PopAction adds a delete element from the head or tail of the list, soListIt can be both a stack and a queue.
Lpush: in the Key corresponding List adds a string element to the header.
Rpush: in the Key corresponding to the List the tail of the add string element.
Linsert: in the Key corresponding List adds a string before or after a specific location.
LSet : Set List Specifies the value of the element in the subscript.
Lrem: from Key corresponding List deleted in N A and value the same element. (n <0 removed from tail,n=0 all deleted)
above the lrem mylist5 1 "Hello" represents a form of Mylist5 deleted in 1 A and Hello the same value.
The number returned above represents the number of deletions.
LTrim: Keep the specified Key data within the range of values.
For example: LTrim list8 1-1 indicates that the keep subscript is 1 to the value of the last element, the other elements are removed.
Lpop: from List The header removes the element and returns the deleted element.
Rpop list10
Lrange list10 0-1
Rpoplpush: from the first List the trailing element is removed and added to the second List 's head.
among them: Rpoplpush mylist5 Mylist6 The meaning of the expression is to Mylist5 the elements in the popup are given Mylist6.
then check Mylist5, found only one three , and then look at the Mylist6, There are three elements found, namely: Hello,hello,foo
lindex: returns the name of Key of the List in the Index the element of the position.
Llen : See how many elements are in a linked list
Redis Database for 03_nosql database: list type