127.0.0.1:6379> keys *
(empty list or set)
127.0.0.1:6379> LPUSH list one
(integer) 1
127.0.0.1:6379> LPUSH list two
(integer) 2
127.0.0.1:6379> LPUSH list thtee
(integer) 3
127.0.0.1:6379> LRANGE list
(error) ERR wrong number of argumen
127.0.0.1:6379> LRANGE list 0 -1 // 获取lsit 中的值
1) "thtee"
2) "two"
3) "one"
127.0.0.1:6379> LRANGE list 0 1 // 通过具体区间 获取某些值
1) "thtee"
2) "two"
127.0.0.1:6379> LPUSH list thtee
127.0.0.1:6379> LRANGE list 0 1
1) "thtee"
2) "two"
127.0.0.1:6379> RPUSH list zhang // 将多个值 放到尾部
(integer) 4
127.0.0.1:6379> LRANGE list 0 -1
1) "thtee"
2) "two"
3) "one"
4) "zhang"
127.0.0.1:6379> LRANGE list 0 -1
同样 移除 LPOP RPOP
eg: Lpop list // 移除左边的值
Rpop list // 移除右边的值
################################
Kindex 获取list 的第一个值
lindex list 1 通过下标获取某一个值
lindex list 0
*********************************
Llen list // 返回列表的长度
移除指定值 : 取关某个up主
lrem list 1 one // 移除list 中 1 个 one
lrem list 2 three // 移除list 中 2 个 three
**************
trim 修剪
trim list 1 2 // 截取得到中间两个values值
##############
rpoplpush
rpoplpush list1 list2 // 移除list1的最后一个 到 新的list2 中首位
EXISTS list
0 // list is not exit
lset list 0 item // add item in index 0 to list //需要先判断类编是否存在
ETT no such key
lpush list value1
LRANGE list 0 0
#"values"
lset list 0 item // 吧list index = 0 value set item 将列表中指定下标的值 更换为某个值
#ok
LRANGE list 0 0
#item
#########################
insert
linsert 左插 右插
Rpush mylist "hello"
Rpush mylist "world"
LINSERT mylist before "world" "honggang"
LRAGNE mylist 0 -1
LINSERT mylist after world zhang
LRANGE mylist 0 -1
list infact is a 链表,before Node after,left,right 都可以插入值
若 key 不存在 创建新的链表
在 新增内容
移除所有值 空链表 不存在
两边插入 或者改动 效率最高 中间操作效率低
消息队列(Lpush Rpop) 栈(Lpush Lpop)