Tutorial by Examples

node_redis, as you may have guessed, is the Redis client for Node.js. You can install it via npm using the following command. npm install redis Once you have installed node_redis module you are good to go. Let’s create a simple file, app.js, and see how to connect with Redis from Node.js. app...
Now that you know how to connect with Redis from Node.js, let’s see how to store key-value pairs in Redis storage. Storing Strings All the Redis commands are exposed as different functions on the client object. To store a simple string use the following syntax: client.set('framework', 'Angula...
Checking the Existence of Keys Sometimes you may need to check if a key already exists and proceed accordingly. To do so you can use exists() function as shown below: client.exists('key', function(err, reply) { if (reply === 1) { console.log('exists'); } else { cons...

Page 1 of 1