In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Lpush: add a string element to the header of the list corresponding to key.
127.0.0.1 purl 6379 > lpush mylist world
(integer) 1
127.0.0.1 purl 6379 > lpush mylist hello
(integer) 2
127.0.0.1 lrange mylist 6379 > 0-1
1) "hello"
2) "world"
Rpush: add a string element to the end of the list corresponding to key.
127.0.0.1 purl 6379 > rpush mylist2 world
(integer) 1
127.0.0.1 purl 6379 > rpush mylist2 hello
(integer) 2
127.0.0.1 lrange mylist2 6379 > 0-1
1) "world"
2) "hello"
Linsert: add a string before or after the specific position of the list corresponding to the key.
127.0.0.1 purl 6379 > rpush mylist3 world
(integer) 1
127.0.0.1 purl 6379 > linsert mylist3 before world hello
(integer) 2
127.0.0.1 lrange mylist3 6379 > 0-1
1) "hello"
2) "world"
Lset: sets the element value of the specified subscript in the list.
127.0.0.1 purl 6379 > rpush mylist4 hello
(integer) 1
127.0.0.1 lrange mylist4 6379 > 0-1
1) "hello"
127.0.0.1 6379 > lset mylist4 0 world
OK
127.0.0.1 lrange mylist4 6379 > 0-1
1) "world"
Lrem: delete n elements that are the same as value from the corresponding list of key. (n rpush mylist5 hello
(integer) 1
127.0.0.1 purl 6379 > rpush mylist5 hello
(integer) 2
127.0.0.1 purl 6379 > rpush mylist5 hello
(integer) 3
127.0.0.1 lrange mylist5 6379 > 0-1
1) "hello"
2) "hello"
3) "hello"
127.0.0.1 6379 > lrem mylist5 1 hello
(integer) 1
127.0.0.1 lrange mylist5 6379 > 0-1
1) "hello"
2) "hello"
127.0.0.1 6379 > lrem mylist5 2 hello
(integer) 2
127.0.0.1 lrange mylist5 6379 > 0-1
(empty list or set)
Ltrim: retains data within the value range of the specified key.
127.0.0.1 purl 6379 > rpush mylist6 one
(integer) 1
127.0.0.1 purl 6379 > rpush mylist6 two
(integer) 2
127.0.0.1 purl 6379 > rpush mylist6 three
(integer) 3
127.0.0.1 lrange mylist6 6379 > 0-1
1) "one"
2) "two"
3) "three"
127.0.0.1 ltrim mylist6 6379 > 1-1
OK
127.0.0.1 lrange mylist6 6379 > 0-1
1) "two"
2) "three"
Lpop: deletes the element from the header of the list and returns the deleted element.
127.0.0.1 lrange mylist6 6379 > 0-1
1) "two"
2) "three"
127.0.0.1 purl 6379 > lpop mylist6
"two"
127.0.0.1 lrange mylist6 6379 > 0-1
1) "three"
Rpop: removes the element from the tail of the list and returns the deleted element.
127.0.0.1 purl 6379 > lpush mylist6 tow
(integer) 2
127.0.0.1 lrange mylist6 6379 > 0-1
1) "tow"
2) "three"
127.0.0.1 purl 6379 > rpop mylist6
"three"
127.0.0.1 lrange mylist6 6379 > 0-1
1) "tow"
Rpoplpush: removes the element from the tail of the first list and adds it to the header of the second list.
127.0.0.1 lrange mylist6 6379 > 0-1
1) "tow"
127.0.0.1 lrange mylist5 6379 > 0-1
1) "two"
127.0.0.1 lrange mylist6 6379 > 0-1
1) "tow"
127.0.0.1 purl 6379 > rpoplpush mylist5 mylist6
"two"
127.0.0.1 lrange mylist5 6379 > 0-1
(empty list or set)
127.0.0.1 lrange mylist6 6379 > 0-1
1) "two"
2) "tow"
Lindex: returns the element of index location in the list with the name key.
127.0.0.1 lrange mylist6 6379 > 0-1
1) "two"
2) "tow"
127.0.0.1 lindex mylist6 6379 > 0
"two"
127.0.0.1 lindex mylist6 6379 > 1
"tow
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.