我想使用 redis 和 RPush 将项目添加到数组中,但我收到了一个错误:
代码
const redis = require('redis');
const redisClient = redis.createClient();
var arr = ["some val","some val2","some val3"];
var multi = redisClient.multi();
for (var i=0; i<arr.length; i++) {
multi.rpush('veggies', arr[i]);
}
multi.exec(function(err, response) {
if(err) throw err;
console.log("response : ", response);
})
错误
WRONGTYPE Operation against a key holding the wrong kind of value
我该如何解决这个问题?谢谢你。