注意:在 Redis 2.4 版本以前,ZADD 每次只能添加一个元素。
ZADD key [NX|XX] [CH] [INCR] score member [score member ...]
127.0.0.1:6379> ZADD stu:1 90 math 85 English 90 history #创建有集合 (integer) 3 127.0.0.1:6379> SADD website www.lmcjl.com (integer) 1 127.0.0.1:6379> ZADD website 90 www.lmcjl.com #如果key类型不是有序集合,则添加失败 (error) WRONGTYPE Operation against a key holding the wrong kind of value 127.0.0.1:6379> ZRANGE stu:1 0 2 WITHSCORES 1) "English" 2) "85" 3) "history" 4) "90" 5) "math" 6) "90"
本文链接:http://task.lmcjl.com/news/6530.html