English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Redis Zunionstore 명령어는 주어진 하나 이상의 정렬된 집합의 합집합을 계산하고, 주어진 key의 수는 numkeys 매개변수로 지정되며, 이 합집합(결과 집합)을 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>