[Node.js]31. Level 7: Redis coming for Node.js, Simple Redis Commands

2023-05-17,,

Let's start practicing using the redis key-value store from our node application. First require the redismodule, 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);
});

[Node.js]31. Level 7: Redis coming for Node.js, Simple Redis Commands的相关教程结束。

《[Node.js]31. Level 7: Redis coming for Node.js, Simple Redis Commands.doc》

下载本文的Word格式文档,以方便收藏与打印。