Install redis
wget http://download.redis.io/releases/redis-3.0.0.tar.gz
tar xvfz redis-3.0.0.tar.gz
cd redis-3.0.0
make
server and client are placed in src/redis-server and src/redis-cli respectively.
Install node.js redis client
npm install redis
create test script
-
for more info, check
var redis = require("redis"), client = redis.createClient(); client.on("error", function (err) { console.log("error event - " + client.host + ":" + client.port + " - " + err); }); client.set("string key", "string val", redis.print); client.hset("hash key", "hashtest 1", "some value", redis.print); client.hset(["hash key", "hashtest 2", "some other value"], redis.print); client.hkeys("hash key", function (err, replies) { if (err) { return console.error("error response - " + err); } console.log(replies.length + " replies:"); replies.forEach(function (reply, i) { console.log(" " + i + ": " + reply); }); }); client.quit(function (err, res) { console.log("Exiting from quit command."); }); for more info, check http://redis.io/
全站熱搜