English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Il comando Redis Zunionstore calcola l'intersezione di uno o più set ordinati, dove il numero di chiavi fornite deve essere specificato con il parametro numkeys e l'intersezione (risultato) viene salvata in destination.
默认情况下,结果集中某个成员的分数值是所有给定集下该成员分数值之和 。
redis Zunionstore 命令基本语法如下:
redis 127.0.0.1:6379> ZUNIONSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX]
>= 2.0.0
保存到 destination 的结果集的成员数量。
redis> ZADD zset1 1 "one"
(integer) 1
redis> ZADD zset1 2 "two"
(integer) 1
redis> ZADD zset2 1 "one"
(integer) 1
redis> ZADD zset2 2 "two"
(integer) 1
redis> ZADD zset2 3 "three"
(integer) 1
redis> ZUNIONSTORE out 2 zset1 zset2 WEIGHTS 2 3
(integer) 3
redis> ZRANGE out 0 -1 WITHSCORES
1) "one"
2) "5"
3) "three"
4) "9"
5) "two"
6) "10"
redis>