我試圖從redis中使用hgetall
獲取所有值,以返回所有'Task_'*
值。如何獲取節點上的所有redis
代碼:
var redis = require('redis'),
client = redis.createClient();
var tasks = [
{
"_id" : "t1",
"creationDate" : "2015-10-02T19:39:37.181Z",
"device" : "2"
},{
"_id" : "t2",
"creationDate" : "2015-10-02T19:39:37.181Z",
"device" : "1"
}
];
tasks.forEach(function(task){
client.set("task_"+task._id, JSON.stringify(task));
})
client.hgetall("task_", function(e, dt){
if(e)console.log(e);
console.log(dt);
})
hgetall
回報null
如果您有解決方案,請將其標記爲已接受。這是如何工作的! –