Comparing version 1.0.0-alpha-07 to 1.0.0-alpha-08
@@ -40,2 +40,3 @@ // Generated by CoffeeScript 1.9.0 | ||
function Adapter(_at_configuration) { | ||
var k, v, _ref2; | ||
this.configuration = _at_configuration; | ||
@@ -47,2 +48,10 @@ this.configuration = merge(defaults, this.configuration); | ||
} | ||
this.options = {}; | ||
_ref2 = this.configuration; | ||
for (k in _ref2) { | ||
v = _ref2[k]; | ||
if (k !== "port" && k !== "host") { | ||
this.options[k] = v; | ||
} | ||
} | ||
} | ||
@@ -54,3 +63,3 @@ | ||
var client; | ||
return client = redis.createClient(_this.configuration.port, _this.configuration.host).on("ready", function() { | ||
return client = redis.createClient(_this.configuration.port, _this.configuration.host, _this.options).on("ready", function() { | ||
_this.log("RedisAdapter: Connected to Redis server @ " + _this.configuration.host + ":" + _this.configuration.port); | ||
@@ -111,3 +120,7 @@ _this.client = liftAll(redis.RedisClient.prototype, liftCommands, client); | ||
if (res != null) { | ||
return JSON.parse(res); | ||
if (this.adapter.options.return_buffers) { | ||
return res; | ||
} else { | ||
return JSON.parse(res); | ||
} | ||
} else { | ||
@@ -119,3 +132,7 @@ return null; | ||
Collection.prototype.put = function(key, object) { | ||
return this.adapter.client.hset(this.name, key, JSON.stringify(object)); | ||
if (this.adapter.options.return_buffers) { | ||
return this.adapter.client.hset(this.name, key, object); | ||
} else { | ||
return this.adapter.client.hset(this.name, key, JSON.stringify(object)); | ||
} | ||
}; | ||
@@ -122,0 +139,0 @@ |
{ | ||
"name": "pirate", | ||
"version": "1.0.0-alpha-07", | ||
"version": "1.0.0-alpha-08", | ||
"description": "A simple key-value storage interface with adapters for different databases", | ||
@@ -15,6 +15,7 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"coffee-script": "^1.9.0" | ||
"coffee-script": "^1.9.0", | ||
"json": "^9.0.3" | ||
}, | ||
"engines" : { | ||
"node" : ">=0.11" | ||
"engines": { | ||
"node": ">=0.11" | ||
}, | ||
@@ -21,0 +22,0 @@ "scripts": { |
35676
13
853
2