1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-01 16:46:54 +03:00
Files
node-redis/examples/simple.js
Ruben Bridgewater 94e9f1fcfc Replace jshint with eslint and add lots of rules
Fix eslint errors accordingly
2016-03-26 14:45:12 +01:00

27 lines
763 B
JavaScript

'use strict';
var redis = require('redis');
var client = redis.createClient();
client.on('error', function (err) {
console.log('error event - ' + client.host + ':' + client.port + ' - ' + err);
});
client.set('string key', 'string val', redis.print);
client.hset('hash key', 'hashtest 1', 'some value', redis.print);
client.hset(['hash key', 'hashtest 2', 'some other value'], redis.print);
client.hkeys('hash key', function (err, replies) {
if (err) {
return console.error('error response - ' + err);
}
console.log(replies.length + ' replies:');
replies.forEach(function (reply, i) {
console.log(' ' + i + ': ' + reply);
});
});
client.quit(function (err, res) {
console.log('Exiting from quit command.');
});