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 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 1236846..7deda62 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; @@ -7,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); @@ -36,7 +35,7 @@ RedisBackend.prototype.set = function (options, cb) { item.checksum = checksum; var data; try { - data = JSON.stringify(hydration.dehydrate(item)); + data = JSON.stringify(item); } catch (e) { return cb(e); @@ -57,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); @@ -138,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..73146c1 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,10 @@ { "name": "stow", - "version": "0.0.6", + "version": "0.0.8", "description": "Caching with a flexible invalidation strategy", "main": "stow.js", "dependencies": { - "hydration": "~0.4.0", - "haredis": "~0.2.8" + "redis": "^2.2.5" }, "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 +};