gpt4 book ai didi

node.js - HDEL、HSET 在 NodeJS 中不工作

转载 作者:IT王子 更新时间:2023-10-29 06:00:22 25 4
gpt4 key购买 nike

谁能告诉我这段代码有什么问题?

redis.hdel("hash:" + id + " key" function(err, success) {
console.log("Hash Deleted");
});

还有其他方法吗?

而且我也在为 HSET 苦苦挣扎:

redis.hset("hash:" + id + " key", "true");

它告诉我“参数数量错误”。它还期待什么?在HSET的Redis文档中,没有更多的参数。

所以我改用了 HMSET,它工作正常。 :)

此外,如果有人能告诉我一些来源,我可以在其中找到所有命令的示例,或者至少是 NodeJS 中的所有哈希命令。

谢谢。

最佳答案

HSET 接受三个参数,keyfieldvalueHDEL 有两个,keyfield。你试过了吗,as per the readme :

client.hset("key", "field", "value", callback);

同样,

client.hdel("key", "field", callback);

关于node.js - HDEL、HSET 在 NodeJS 中不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12291673/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com