问题
I am currently writing an app using redis and I'm having issues with the node_redis library. In particular I am unable to figure out how to use the redis command from within node_redis
I have tried all the following...
client.send_command("CONFIG SET", ["notify-keyspace-events", "Ex"]);
client.config("SET", ["notify-keyspace-events", "Ex"]);
This and other similar variants don't seem to be working... Also I cannot find the command detailed out on the node_redis documentation.
Any help would be greatly appreciated!
ON A SIDE NOTE: I am using this command to create a client (node-side) that will subscribe to key-expire events (I want to perform a couple clean-up operations every time a key expires). Is it acceptable to use the node_redis CONFIG SET equivalent or is it better/common practice to start redis-server with a custom conf file? I would assume the latter however I want to deploy this on Heroku, does that change the circumstances?
Thanks!
回答1:
You’re very close! The usage is:
client.config("SET", "notify-keyspace-events", "Ex");
来源:https://stackoverflow.com/questions/27210840/node-redis-config-set-command