for (i=0 ; i < pri.state.totalConversations; i++) {
redisclient.lindex("conversationsIDList",i, function(err,reply) {
convID = reply;
console.log("ConvID: " + "i: " + i + " "+ convID);
});
if(convID == pri.state.lastUpdatedConversationID)
break;
redisclient.hget("conversations", convID, function(err,reply) {
console.log("ConvID hget: "+ convID + " "+ reply);
data = JSON.parse(reply);
console.log("data: " +data);
});
以上是我的代码片段。redis-cli hget 命令返回正确的答案,确认我使用正确的键和字段/值正确设置了哈希。但是,上面的代码片段为 hget 返回“null”,(convID 具有正确的值,这是 hget 的字段)-我不明白为什么-