Everyone should remember that Node.js is mainly used to build high-performance, highly scalable server and client applications, and it is oriented to the "real-time Web".
The goal of Node.js is to provide a "simple way to build scalable web servers" and is influenced by the Event Machine from the Ruby language and the Twisted framework from Python.
Redis is an open source log-type Key-Value database written in ANSI C language, supports network, can be memory-based and persistent, and provides APIs in multiple languages. Since March 15, 2010, the development of Redis has been hosted by VMware.
1. Install the Node.js driver for Redis
The computer is stuck here and the npm remote server connection is very slow. What should I do?
Consider using NPM’s domestic mirror server.
There are three methods:
1) Use the config command
2) Command line specification
3) Edit ~/.npmrc and add the following content:
Execute the Redis driver installation again:
Done!
2. Write test program
client.on("error", function(err){
console.log("Error: " err);
});
client.on("connect", function(){
// start server();
Client.set("name_key", "hello world", function(err, reply){
console.log(reply.toString());
});
client.get("name_key", function(err, reply){
console.log(reply.toString());
});
})
3. Execute the program