You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
18 lines
614 B
JavaScript
18 lines
614 B
JavaScript
var redis = require("redis"),
|
|
client = redis.createClient();
|
|
|
|
client.on("error", function (err) {
|
|
console.log("Redis connection error to " + 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) {
|
|
console.log(replies.length + " replies:");
|
|
replies.forEach(function (reply, i) {
|
|
console.log(" " + i + ": " + reply);
|
|
});
|
|
client.quit();
|
|
});
|