0

I'm using the node.js Redis library and I'm attempting to bulk-subscribe to many keys. I've got an array which is dynamic i.e

var keys {'key1','key2',...,'keyN'}

and I want to feed each index in as parameters to subscribe in the Redis library which takes one or more string(s). I've tried the apply function in JS using..

redisClient.subscribe.apply(this,keys);

but it doesn't cause a subscription. Any suggestions on how I can get over this issue?

1

1 Answer 1

2

Your example data is totally invalid JS, but I'm assuming you have it correct in your code. You need to set the proper function context:

redisClient.subscribe.apply(redisClient, keys);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.