//npm install redis
var redis = require("redis"),
client = redis.createClient();
client.set("stringkey", "v1", redis.print);
client.get('stringkey', function (err, data) {
console.log(data);
client.quit();
})
// client.hset("hashkey", "hashtest 1", "some value", redis.print);
// client.hset(["hashkey", "k1", "v1", "k2", "v2"], redis.print);
// client.hkeys("hashkey", function (err, replies) {
// console.log(replies.length + " replies:");
// replies.forEach(function (reply, i) {
// console.log(" " + i + ": " + reply);
// });
// client.quit();
// });
// client.hget("hashkey", "k1", function (err, data) {
// console.log(data);
// client.quit();
// });
// client.hgetall("hashkey", function (err, data) {
// console.log(data);
// client.quit();
// })
node-redis基本操作
最新推荐文章于 2024-05-09 09:44:30 发布