From 06173ff6beced4f9fbd7ea4f069eb3b1e13480a2 Mon Sep 17 00:00:00 2001 From: Matt Ranney Date: Tue, 14 Sep 2010 01:29:19 -0700 Subject: [PATCH] Add simple example. --- README.md | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1e7948d0ba..21971ea15a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,33 @@ -=== redis - a node redis client +redis - a node redis client +=========================== This is a Redis client for node. It is designed for node 0.2.1+ and redis 2.0.1+. + +Example usage: + + var redis = require("redis"), + client = redis.createClient(); + + client.on("connect", function () { + client.set(["string key", "string val"], function (err, results) { + console.log("SET: " + results); + }); + client.hset(["hash key", "hashtest 1", "should be a hash"], function (err, results) { + console.log("HSET: " + results); + }); + client.hset(["hash key", "hashtest 2", "should be a hash"], function (err, results) { + console.log("HSET: " + results); + }); + client.hkeys(["hash key"], function (err, results) { + console.log("HKEYS: " + results); + }); + }); + +This will display: + + SET: OK + HSET: 1 + HSET: 1 + HKEYS: hashtest 1,hashtest 2 + +More instructions will be available as soon as the tests all pass.