[Node.js]31. Level 7: Redis coming for Node.js, Simple Redis Commands
Let's start practicing using the redis key-value store from our node application. First require the redis
module, and then create a redis client that we can use to call commands on our redis server.
Use the client to set the name
key to your name.
var redis = require('redis'); var client = redis.createClient(); client.set("name", "Zhentian");
We already have stored a value in the question
key. Use the redis client to issue a get
command to redis to retrieve and then log the value.
var redis = require('redis'); var client = redis.createClient(); client.get("question", function(err, data){ console.log(data); });