From 64773d26c5bd4407f6d388bedb72b0bd149ca53e Mon Sep 17 00:00:00 2001 From: wenyekui Date: Wed, 13 Aug 2014 16:18:14 +0800 Subject: [PATCH] add zunionstore & zinterstore for node.js client --- client/nodejs/example.js | 15 ++++++++++++++- client/nodejs/ledis/lib/commands.js | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/client/nodejs/example.js b/client/nodejs/example.js index f28c50a..101a106 100644 --- a/client/nodejs/example.js +++ b/client/nodejs/example.js @@ -35,4 +35,17 @@ client.bget("bit key 3", function(err, result){ } }); -client.quit(); +//test zunionstore & zinterstore +client.zadd("zset1", 1, "one") +client.zadd("zset1", 2, "two") + +client.zadd("zset2", 1, "one") +client.zadd("zset2", 2, "two") +client.zadd("zset2", 3, "three") + +client.zunionstore("out", 2, "zset1", "zset2", "weights", 2, 3, ledis.print) +client.zrange("out", 0, -1, "withscores", ledis.print) + +client.zinterstore("out", 2, "zset1", "zset2", "weights", 2, 3, ledis.print) +client.zrange("out", 0, -1, "withscores", ledis.print) +client.quit() diff --git a/client/nodejs/ledis/lib/commands.js b/client/nodejs/ledis/lib/commands.js index 8e5a524..e814d23 100644 --- a/client/nodejs/ledis/lib/commands.js +++ b/client/nodejs/ledis/lib/commands.js @@ -83,6 +83,8 @@ module.exports = [ "zrevrank", "zrevrangebyscore", "zscore", + "zunionstore", + "zinterstore", "zclear",