Skip to content

Commit 8f18b34

Browse files
committed
Merge branch 'release/0.2.4'
2 parents 20c91ac + ad6754c commit 8f18b34

File tree

5 files changed

+145
-96
lines changed

5 files changed

+145
-96
lines changed

index.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,8 @@ function redisStore(args) {
7272
}
7373

7474
if (opts.parse) {
75-
7675
try {
77-
// allow undefined only if allowed by isCacheableValue
78-
if(! ( (result === undefined || result === 'undefined') && typeof args.isCacheableValue === 'function' && args.isCacheableValue(result))) {
79-
result = JSON.parse(result);
80-
}
76+
result = JSON.parse(result);
8177
} catch (e) {
8278
return cb && cb(e);
8379
}
@@ -129,7 +125,8 @@ function redisStore(args) {
129125
}
130126

131127
/**
132-
* Apply some options like hostname , port, db, ttl auth_pass from options to newArgs host, port, db, auth_pass and ttl and return clone of args
128+
* Apply some options like hostname, port, db, ttl, auth_pass, password
129+
* from options to newArgs host, port, db, auth_pass, password and ttl and return clone of args
133130
* @param {Object} args
134131
* @param {Object} options
135132
* @returns {Object} clone of args param with properties set to those of options
@@ -140,6 +137,7 @@ function redisStore(args) {
140137
newArgs.port = parseInt(options.port, 10);
141138
newArgs.db = parseInt(options.database, 10);
142139
newArgs.auth_pass = options.password;
140+
newArgs.password = options.password;
143141
if(options.query && options.query.ttl){
144142
newArgs.ttl = parseInt(options.query.ttl, 10);
145143
}
@@ -185,6 +183,10 @@ function redisStore(args) {
185183
options = {};
186184
}
187185

186+
if (!self.isCacheableValue(value)) {
187+
return cb(new Error('value cannot be ' + value));
188+
}
189+
188190
options = options || {};
189191

190192
var ttl = (options.ttl || options.ttl === 0) ? options.ttl : redisOptions.ttl;
@@ -193,7 +195,7 @@ function redisStore(args) {
193195
if (err) {
194196
return cb && cb(err);
195197
}
196-
var val = JSON.stringify(value);
198+
var val = JSON.stringify(value) || '"undefined"';
197199
if (ttl) {
198200
conn.setex(key, ttl, val, handleResponse(conn, cb));
199201
} else {

package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "cache-manager-redis",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"description": "Redis store for the node-cache-manager",
55
"main": "index.js",
66
"scripts": {
7-
"test": "node_modules/.bin/jasmine",
8-
"coverage": "node_modules/.bin/istanbul cover node_modules/.bin/jasmine",
7+
"test": "node_modules/.bin/mocha --recursive test",
8+
"coverage": "node_modules/.bin/istanbul cover _mocha -- test --recursive",
99
"lint": "node_modules/.bin/jshint .",
1010
"jsdoc": "node_modules/.bin/jsdoc . --package package.json --readme README.md --template node_modules/minami --destination docs"
1111
},
@@ -24,15 +24,14 @@
2424
"dependencies": {
2525
"cache-manager": "^1.2.2",
2626
"redis-url": "^1.2.1",
27-
"sol-redis-pool": "^0.2.1"
27+
"sol-redis-pool": "^0.3.1"
2828
},
2929
"devDependencies": {
30-
"codacy-coverage": "^1.1.3",
3130
"istanbul": "^0.4.0",
32-
"jasmine": "^2.3.2",
3331
"jsdoc": "^3.3.3",
3432
"jshint": "^2.8.0",
3533
"minami": "^1.1.1",
34+
"mocha": "^3.0.2",
3635
"sinon": "^1.17.2"
3736
}
3837
}

spec/support/jasmine.json

Lines changed: 0 additions & 6 deletions
This file was deleted.
File renamed without changes.

0 commit comments

Comments
 (0)