Redis ZINTERSTORE command computes the intersection of numkeys sorted sets given by the specified keys, and stores the result in the destination. It is mandatory to provide the number of input keys (numkeys) before passing the input keys and the other (optional) arguments.
Return Value
Integer reply, the number of elements in the resulting sorted set at the destination.
Syntax
Following is the basic syntax of Redis ZINTERSTORE command.
redis 127.0.0.1:6379> ZINTERSTORE KEY INCREMENT MEMBER
Example
redis 127.0.0.1:6379> ZADD myset 1 "hello" (integer) 1 redis 127.0.0.1:6379> ZADD myset 2 "world" (integer) 1 redis 127.0.0.1:6379> ZADD myset2 1 "hello" (integer) 1 redis 127.0.0.1:6379> ZADD myset2 2 "world" (integer) 1 redis 127.0.0.1:6379> ZADD myset2 3 "foo" (integer) 1 redis 127.0.0.1:6379> ZINTERSTORE out 2 myset1 myset2 WEIGHTS 2 3" (integer) 3 redis 127.0.0.1:6379> ZRANGE out 0 -1 WITHSCORES 1) "hello" 2) "5" 3) "world" 4) "10"
Pingback: Redis - Sorted Sets - Adglob Infosystem Pvt Ltd
Major thankies for the blog.Really looking forward to read more. Really Cool.