1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

Organize examples.

This commit is contained in:
Matt Ranney
2010-10-20 16:38:33 -07:00
parent 85bd648adc
commit 1c5f73f541
7 changed files with 6 additions and 1 deletions

View File

@@ -1,7 +1,9 @@
// Note - Eventually this functionality will be built in to the client library
var redis = require("redis"), var redis = require("redis"),
client = redis.createClient(); client = redis.createClient();
// whenever the client connects, make sure // whenever the client connects, make sure to auth
client.on("connect", function () { client.on("connect", function () {
client.auth("somepass", redis.print); client.auth("somepass", redis.print);
}); });

View File

@@ -1,3 +1,5 @@
// Read a file from disk, store it in Redis, then read it back from Redis.
var redis = require("redis"), var redis = require("redis"),
client = redis.createClient(), client = redis.createClient(),
fs = require("fs"), fs = require("fs"),

View File

@@ -4,6 +4,7 @@ var redis = require("redis"),
redis.debug_mode = false; redis.debug_mode = false;
// Most clients probably don't do much on "subscribe". This example uses it to coordinate things within one program.
client1.on("subscribe", function (channel, count) { client1.on("subscribe", function (channel, count) {
console.log("client1 subscribed to " + channel + ", " + count + " total subscriptions"); console.log("client1 subscribed to " + channel + ", " + count + " total subscriptions");
if (count === 2) { if (count === 2) {