node_redis CONFIG SET command

独自空忆成欢 提交于 2020-01-24 14:29:00

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!