注意:默认情况下,结果集中某个成员的分数值是所有给定集合中该成员的分数值之和。
ZUNIONSTORE destination numkeys key [key ...] [WEIGHTS weight] [AGGREGATE SUM|MIN|MAX]
127.0.0.1:6379> ZADD salary 3000 jack 3500 helen 2880 john 4000 simith 6000 ros #添加元素 (integer) 5 127.0.0.1:6379> ZADD salary1 1000 BaoAn 2000 ChuShi 1500 BaoJie (integer) 3 #给salary1有序集合中所有成员工资翻倍。并将结果保存至salary2 127.0.0.1:6379> ZUNIONSTORE salary2 2 salary salary1 WEIGHTS 1 2 (integer) 8 127.0.0.1:6379> ZRANGE salary2 0 -1 withscores #查看所有元素 1) "BaoAn" 2) "2000" 3) "john" 4) "2880" 5) "BaoJie" 6) "3000" 7) "jack" 8) "3000" 9) "helen" 10) "3500" 11) "ChuShi" 12) "4000" 13) "simith" 14) "4000" 15) "ros" 16) "6000"
本文链接:http://task.lmcjl.com/news/12488.html