inter

UK[ɪnˈtɜ:(r)] US[ɪnˈtə:]

vt.bury, bury

Third person singular: inters Present participle: interring Past tense: interred Past participle: interred

store

## English[stɔ:(r)] US[stɔr, stor]

n. Store; storage; warehouse; large amount

v. storage; (in a computer) storage

Third person singular: stores Plural: stores Present participle: storing Past tense: stored Past participle: stored

redis ZINTERSTORE command syntax

Function:Calculate the intersection of one or more given ordered sets, where the number of given keys must be specified with the numkeys parameter, and store the intersection (result set) in destination.

Syntax: ZINTERSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX]

Available versions: >= 2.0.0

Time complexity: O(N*K) O(M*log(M)), N is the given key The ordered set with the smallest cardinality, K is the number of given ordered sets, and M is the cardinality of the result set.

Returns: The cardinality of the result set saved to destination.

redis ZINTERSTORE command example

redis > ZADD mid_test 70 "Li Lei"
(integer) 1
redis > ZADD mid_test 70 "Han Meimei"
(integer) 1
redis > ZADD mid_test 99.5 "Tom"
(integer) 1
redis > ZADD fin_test 88 "Li Lei"
(integer) 1
redis > ZADD fin_test 75 "Han Meimei"
(integer) 1
redis > ZADD fin_test 99.5 "Tom"
(integer) 1
redis > ZINTERSTORE sum_point 2 mid_test fin_test
(integer) 3
redis > ZRANGE sum_point 0 -1 WITHSCORES     # 显示有序集内所有成员及其 score 值
1) "Han Meimei"
2) "145"
3) "Li Lei"
4) "158"
5) "Tom"
6) "199"