connect-redis
Advanced tools
Comparing version 2.4.1 to 2.5.0
2.5.0 / 2015-08-28 | ||
================== | ||
* Add support to override serializer | ||
* Add io-redis test | ||
2.4.1 / 2015-07-24 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -58,2 +58,4 @@ /*! | ||
this.serializer = options.serializer || JSON; | ||
/* istanbul ignore next */ | ||
@@ -160,3 +162,3 @@ if (options.url) { | ||
try { | ||
result = JSON.parse(data); | ||
result = store.serializer.parse(data); | ||
} | ||
@@ -185,3 +187,3 @@ catch (er) { | ||
try { | ||
var jsess = JSON.stringify(sess); | ||
var jsess = store.serializer.stringify(sess); | ||
} | ||
@@ -188,0 +190,0 @@ catch (er) { |
{ | ||
"name": "connect-redis", | ||
"description": "Redis session store for Connect", | ||
"version": "2.4.1", | ||
"version": "2.5.0", | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
@@ -24,2 +24,3 @@ "contributors": [ | ||
"express-session": "^1.9.1", | ||
"ioredis": "^1.7.5", | ||
"istanbul": "^0.3.2", | ||
@@ -26,0 +27,0 @@ "tape": "^3.0.3" |
@@ -33,2 +33,3 @@ # Connect Redis | ||
- `unref` Set `true` to unref the Redis client. **Warning**: this is [an experimental feature](https://github.com/mranney/node_redis#clientunref). | ||
- `serializer` An object containing `stringify` and `parse` methods compatible with Javascript's `JSON` to override the serializer used | ||
@@ -35,0 +36,0 @@ Any options not included in this list will be passed to the redis `createClient()` method directly. |
@@ -7,2 +7,3 @@ var P = require('bluebird'); | ||
var redis = require('redis'); | ||
var ioRedis = require('ioredis'); | ||
@@ -60,2 +61,8 @@ // Takes a store through all the operations | ||
test('io redis client', function (t) { | ||
var client = ioRedis.createClient(8543, 'localhost'); | ||
var store = new RedisStore({ client: client }) | ||
return lifecycleTest(store, t); | ||
}); | ||
test('options', function (t) { | ||
@@ -99,1 +106,16 @@ var store = new RedisStore({ | ||
}); | ||
test('serializer', function (t) { | ||
var serializer = { | ||
stringify: function() { return 'XXX'+JSON.stringify.apply(JSON, arguments); }, | ||
parse: function(x) { | ||
t.ok(x.match(/^XXX/)); | ||
return JSON.parse(x.substring(3)); | ||
} | ||
}; | ||
t.equal(serializer.stringify('UnitTest'), 'XXX"UnitTest"'); | ||
t.equal(serializer.parse(serializer.stringify("UnitTest")), 'UnitTest'); | ||
var store = new RedisStore({ port: 8543, serializer: serializer }); | ||
return lifecycleTest(store, t); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18158
347
80
7