-
-
Save anonymous/deb3b283eda5e51f75ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Module | |
var db = require('redis').createClient(6379, 'nodejitsudb396014559.redis.irstack.com'); | |
db.auth('nodejitsudb396014559.redis.irstack.com:f327cfe980c971946e80b8e975fbebb4', function (err) { | |
if (err) { | |
console.log('Cannot Connect to Database: Error: ', err); | |
} | |
console.log('Connected to Redis Database'); | |
}); | |
db.on('error', function (err) { | |
console.log('Debug: Redis Error: ', err); | |
return undefined; | |
}); | |
module.exports = db; | |
//Usage | |
var db = require('./db.js'); | |
db.set('some key', 'some value', function (err, signal) {...}); | |
db.get(...); | |
db.hset(...); | |
db.hget(...); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment