node_redis CONFIG SET 命令 [英] node_redis CONFIG SET command

查看:55
本文介绍了node_redis CONFIG SET 命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用 redis 编写应用程序,但在使用 node_redis 库时遇到了问题.特别是我无法弄清楚如何在 node_redis 中使用 redis 命令

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"]);

这个和其他类似的变体似乎不起作用...我也找不到 node_redis 文档中详细列出的命令.

This and other similar variants don't seem to be working... Also I cannot find the command detailed out on the node_redis documentation.

任何帮助将不胜感激!

侧面注意:我正在使用此命令创建一个客户端(节点端),该客户端将订阅密钥到期事件(我想在每次密钥到期时执行一些清理操作).使用 node_redis CONFIG SET 等效项是否可以接受,或者使用自定义 conf 文件启动 redis-server 是否更好/更常见?我会假设后者,但我想在 Heroku 上部署它,这会改变情况吗?

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?

谢谢!

推荐答案

你已经很接近了!用法是:

You’re very close! The usage is:

client.config("SET", "notify-keyspace-events", "Ex");

这篇关于node_redis CONFIG SET 命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆