127.0.0.1:6379> del name
(integer)1127.0.0.1:6379> hmset user name "zhangjh" age 23
OK
127.0.0.1:6379> hmget user name
1)"zhangjh"127.0.0.1:6379> hmget user age
1)"23"127.0.0.1:6379>
127.0.0.1:6379>127.0.0.1:6379> lpush list redis
(integer)1127.0.0.1:6379> lpush list java
(integer)2127.0.0.1:6379> lpush list springboot
(integer)3127.0.0.1:6379> lpush list zhangjh
(integer)4127.0.0.1:6379> lrange list 0-11)"zhangjh"2)"springboot"3)"java"4)"redis"127.0.0.1:6379>
sadd 命令
添加一个 string 元素到 key 对应的 set 集合中,成功返回1,如果元素已经在集合中返回 0,如果 key 对应的 set 不存在则返回错误。
sadd key member
127.0.0.1:6379> sadd set redis
(integer)1127.0.0.1:6379> sadd set xqq
(integer)1127.0.0.1:6379> sadd set xqq
(integer)0127.0.0.1:6379> sadd set gzh
(integer)1127.0.0.1:6379> semebers set
(error) ERR unknown command 'semebers'127.0.0.1:6379> smembers set
1)"xqq"2)"gzh"3)"redis"127.0.0.1:6379>