How do I apply optional parameters to methods? #391

Closed
shubik opened this Issue Mar 8, 2013 · 2 comments

Projects

None yet

3 participants

shubik commented Mar 8, 2013

Hi Matt,
How do can I apply optional params, e.g.

ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count]

I need to use count because otherwise it returns thousands of results? Or should I apply limit to results already in my code?

Owner

You just add the parameters you need as inputs to the zrangebyscore method:

var r = require("redis").createClient();

r.zadd("myzset", 1, "one");
r.zadd("myzset", 1, "uno");
r.zadd("myzset", 2, "two");

r.zrangebyscore("myzset", "-inf", "+inf", "limit", 0, 2, function (err, replies) {
    console.log(replies);  // [ 'one', 'uno' ]
});
@brycebaril brycebaril closed this Mar 8, 2013
shubik commented Mar 8, 2013

THANKS!

@BridgeAR BridgeAR added the question label Mar 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment