我正在运行node.js 16和redis 5.0,当我尝试连接到redis时,我可以运行info之类的命令,但当我尝试运行hmset时,我收到一个错误,说它不是一个函数。
Welcome to Node.js v16.13.2.
Type ".help" for more information.
> const redis = require("redis");
undefined
> const client = redis.createClient();
undefined
> client.connect()
Promise {
<pending>,
[Symbol(async_id_symbol)]: 98,
[Symbol(trigger_async_id_symbol)]: 5,
[Symbol(destroyed)]: { destroyed: false }
}
> client.hmset("hi", "foo", "bar", "hello", "world");
Uncaught TypeError: client.hmset is not a function
请就如何解决这一问题提供指导。
1条答案
按热度按时间mxg2im7a1#
尝试
hset
函数;它具有相同的功能。Redis中的HMSET命令已弃用,取而代之的是HSET命令。