Skip to content

Commit

Permalink
Clean whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
tonistiigi committed Dec 11, 2012
1 parent 3b4044b commit 4c63f6f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@ var Stream = require('stream').Stream

module.exports = function (url, exports) {
exports = exports || {}

url = parse(url || '')
url.hostname = url.hostname
url.port = url.port || 6379
var prefix = url.path ? url.path.substring(1) : 'kv'

var client = redis.createClient(url.port, url.hostname)
if (url.auth) {
client.auth(url.auth)
}

client.on('error', function (err) {
console.log('Redis error: ' + err)
})
var noop = function() {}

exports.put = function (key, opts) {
var _key = prefix + ':' + key
opts = opts || {flags: 'w'}
if(opts.flags !== 'a') {
client.set(_key, '', noop)
}

var ws = es.through(function (data) {
client.append(_key, data + '\n', noop)
})
Expand All @@ -39,7 +39,7 @@ module.exports = function (url, exports) {

return ws
}

exports.get = function (key, opts) {
var _key = prefix + ':' + key
var ws = new Stream
Expand All @@ -56,16 +56,16 @@ module.exports = function (url, exports) {
})
return ws
}

exports.has = function (key, callback) {
var _key = prefix + ':' + key
client.exists(_key, callback)
}

exports.del = function (key, callback) {
var _key = prefix + ':' + key
client.del(_key, callback)
}

return exports
}

0 comments on commit 4c63f6f

Please sign in to comment.