redis in the list of commonly used commands

list Performance Summary:

  It is a string list, left, rigth can insertion, addition

  If the key does not exist, create a new list

  If the key already exists, add content

  Ruoguo values ​​are all removed, the corresponding keys disappeared.

list commonly used commands :

  lrange key 0 -1: an output in the form of a stack list file

  lpush key value (which may be one or more): Drawing from left to right, into the list (after first-out stack)

                For example: lpush list01 1 2 3 ----> lrange list01 0 -1: output is 321

  rpush key value (which may be one or more): Drawing from right to left into the bottom of the stack, the list is stored

               For example: rpush list02 1 2 3 ----> lrange list02 0 -1: output is 123

               For example: rpush list01 4 5 6 ----> lrange list01 0 -1: output is 3 2 1 4 5 6 (list01 here is inserted on the basis of the above list01)

    lpop key: from the stack out of the stack           

 rpop key: popped from the stack bottom  

 the lindex key index: Get the value of the key at the lower scale (down from the top of the stack to the stack or from the bottom)

 llen key: the length of the key is acquired

  n values ​​lrem key Delete: delete the key from the value of n for example: lrem key 3 x 3 x deleted  

 Start Index End Index ltrim key: the cut-off value range is assigned to the specified key (value comprises a start index and an end index of)

   linsert key before / after the value 1 value 2: 1 value before / after inserting value 2 (if duplicate values ​​1, subject to the first value 1)

   rpoplpush certain key source key: the bottom of the stack from the source key to the target stack push the key top of the stack. 

  

Guess you like

Origin www.cnblogs.com/kukai/p/12608839.html