From 1f3eea96ca0a411e553141ce02ae09d43955f5b9 Mon Sep 17 00:00:00 2001 From: "Matthew J. Martin" Date: Wed, 14 Oct 2015 01:12:52 +0800 Subject: [PATCH 1/7] remove hydration call --- backends/redis.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backends/redis.js b/backends/redis.js index 1236846..a1a8a65 100644 --- a/backends/redis.js +++ b/backends/redis.js @@ -36,7 +36,8 @@ RedisBackend.prototype.set = function (options, cb) { item.checksum = checksum; var data; try { - data = JSON.stringify(hydration.dehydrate(item)); + // data = JSON.stringify(hydration.dehydrate(item)); + data = JSON.stringify(item); } catch (e) { return cb(e); From 5fda632dafdbdc5ec667253c26fcadbe28938a2a Mon Sep 17 00:00:00 2001 From: "Matthew J. Martin" Date: Wed, 14 Oct 2015 01:33:30 +0800 Subject: [PATCH 2/7] deprecate haredis in favor of redis now that its well supported; deprecate hydration lib now that JSON.parse works fine --- backends/redis.js | 8 +++----- package.json | 3 +-- test/common.js | 4 ++-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/backends/redis.js b/backends/redis.js index a1a8a65..5863d08 100644 --- a/backends/redis.js +++ b/backends/redis.js @@ -1,5 +1,4 @@ -var redis = require('haredis') - , hydration = require('hydration'); +var redis = require('redis'); function RedisBackend (options) { this.ttl = options.ttl; @@ -36,7 +35,6 @@ RedisBackend.prototype.set = function (options, cb) { item.checksum = checksum; var data; try { - // data = JSON.stringify(hydration.dehydrate(item)); data = JSON.stringify(item); } catch (e) { @@ -58,7 +56,7 @@ RedisBackend.prototype.get = function (key, cb) { if (!result) return cb(null, null); var item; try { - item = hydration.hydrate(JSON.parse(result)); + item = JSON.parse(result); } catch (e) { return cb(e); @@ -139,4 +137,4 @@ RedisBackend.prototype.validate = function (item, cb) { } }; -module.exports = RedisBackend; \ No newline at end of file +module.exports = RedisBackend; diff --git a/package.json b/package.json index c9beecc..d56de4b 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,7 @@ "description": "Caching with a flexible invalidation strategy", "main": "stow.js", "dependencies": { - "hydration": "~0.4.0", - "haredis": "~0.2.8" + "redis": "^2.2.1" }, "devDependencies": { "mocha": "*" diff --git a/test/common.js b/test/common.js index 7138419..b6c31f6 100644 --- a/test/common.js +++ b/test/common.js @@ -1,7 +1,7 @@ stow = require('../'); assert = require('assert'); util = require('util'); -redis = require('haredis'); +redis = require('redis'); // Test a backend. testBackend = function (Backend, options) { @@ -262,4 +262,4 @@ testBackend = function (Backend, options) { }); } -}; \ No newline at end of file +}; From d91072495e890b04cee2b9c3805fbbae9727004e Mon Sep 17 00:00:00 2001 From: "Matthew J. Martin" Date: Wed, 14 Oct 2015 01:38:26 +0800 Subject: [PATCH 3/7] update node versions --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 011db61..5d5d181 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: node_js node_js: - - 0.8 - - '0.10' + - "0.12" + - "0.11" + - "0.10" services: - redis-server From 746cf6c475a6e21d2bdcf948d85f6ae3cd4a1b6e Mon Sep 17 00:00:00 2001 From: "Matthew J. Martin" Date: Mon, 26 Oct 2015 13:18:34 -0700 Subject: [PATCH 4/7] update configuration passing to work with non-ha version of redis --- README.md | 2 +- backends/redis.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b8dfe32..b91c65f 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ var stow = require('stow'); // Create your cache. var cache = stow.createCache(stow.backends.Redis, { - nodes: ['localhost:6379'] + redis: 'localhost:6379' }); // Add items to the cache. diff --git a/backends/redis.js b/backends/redis.js index 5863d08..7deda62 100644 --- a/backends/redis.js +++ b/backends/redis.js @@ -6,11 +6,11 @@ function RedisBackend (options) { if (options.client) { this.client = options.client; } - else if (options.nodes) { - this.client = redis.createClient(options.nodes, options); + else if (options) { + this.client = redis.createClient(options.redis, options); } else { - this.client = redis.createClient(['localhost:6379'], options); + this.client = redis.createClient('localhost:6379', options); } if (options.db) { this.client.select(db); From 7c46a892c79cce591378150025438248eb790bdb Mon Sep 17 00:00:00 2001 From: "Matthew J. Martin" Date: Mon, 26 Oct 2015 13:19:13 -0700 Subject: [PATCH 5/7] rev version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d56de4b..4025bfb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stow", - "version": "0.0.6", + "version": "0.0.7", "description": "Caching with a flexible invalidation strategy", "main": "stow.js", "dependencies": { From db17009c49fa02762aed05983c61378892e5d1b5 Mon Sep 17 00:00:00 2001 From: "Matthew J. Martin" Date: Tue, 27 Oct 2015 21:24:46 -0700 Subject: [PATCH 6/7] upgrade redis client --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4025bfb..48861d2 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Caching with a flexible invalidation strategy", "main": "stow.js", "dependencies": { - "redis": "^2.2.1" + "redis": "^2.2.5" }, "devDependencies": { "mocha": "*" From 9f4f4024ff728159f9c8c380b5179d434343583f Mon Sep 17 00:00:00 2001 From: "Matthew J. Martin" Date: Tue, 27 Oct 2015 21:25:36 -0700 Subject: [PATCH 7/7] update redis client --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 48861d2..73146c1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stow", - "version": "0.0.7", + "version": "0.0.8", "description": "Caching with a flexible invalidation strategy", "main": "stow.js", "dependencies": {