Skip to content

Instantly share code, notes, and snippets.

@alexellis
Created January 7, 2016 13:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexellis/fd7e9e520f186deac448 to your computer and use it in GitHub Desktop.
Save alexellis/fd7e9e520f186deac448 to your computer and use it in GitHub Desktop.
node-redis-fail
var redis = require ('node-redis');
var updateCounter = function(done) {
var client = redis.createClient("6379",function (err) {
if(err) {
return console.error(err);
}
client.incr("hit_counter", function(ierr) {
if(ierr) {
return console.error(ierr);
}
client.get("hit_counter", function(err, val) {
client.quit();
done(val.toString());
});
});
});
};
try {
updateCounter(function(count) {
console.log("All done, count="+count);
});
} catch (e) {
console.error("Error: " + e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment