Tag: redisclient

redis客户端和节点js – hgetall方法失败,结果为空

对于我来说,这是第一天使用redis cilent和node js。 我试图复制这个命令,我通过node.js中的redis-cli运行: 127.0.0.1:6379> HGETALL widgets:9145090003_00:00_00:00 1) "id" 2) "33305" 3) "loc" 4) "jamaica" 5) "days" 6) "" 这里是nodejs代码: client.hgetall("widgets:9145090003_00:00_00:00", function (err, replies) { console.log(err); replies.forEach(function (reply,i) { console.log(' ' + i + ':' + reply); }); }); 它返回null,然后尝试做foreach时失败。 我也试过: client.hgetall("widgets", function (err, replies) { console.log(err); replies.forEach(function (reply,i) { console.log(' ' + i + […]

节点js应用与redis后端 – 如何发送“扫描”命令

我刚刚为我的节点应用程序安装了一个redis客户端。 包装信息如下: me@mydevbox:/var/www/html/node/test$ cat package.json { "name": "test", "version": "0.0.0", "private": true, "scripts": { "start": "node ./bin/www" }, "dependencies": { "body-parser": "~1.13.2", "cookie-parser": "~1.3.5", "debug": "~2.2.0", "ejs": "~2.3.3", "express": "~4.13.1", "morgan": "~1.6.1", "redis": "^2.6.2", "serve-favicon": "~2.3.0" } } 我需要在我的节点js应用程序中运行以下命令: 127.0.0.1:6379> SCAN 0 match widget:914* 1) "0" 2) 1) "widget:9145090003_13:00_17:00" 2) "widget:9145090003_00:00_00:00" 3) "widget:9145090003_08:00_12:00" 127.0.0.1:6379> 但是我一直在阅读文档,目前还不清楚如何做到这一点。 […]