@@ -72,12 +72,8 @@ function redisStore(args) {
72
72
}
73
73
74
74
if ( opts . parse ) {
75
-
76
75
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 ) ;
81
77
} catch ( e ) {
82
78
return cb && cb ( e ) ;
83
79
}
@@ -129,7 +125,8 @@ function redisStore(args) {
129
125
}
130
126
131
127
/**
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
133
130
* @param {Object } args
134
131
* @param {Object } options
135
132
* @returns {Object } clone of args param with properties set to those of options
@@ -140,6 +137,7 @@ function redisStore(args) {
140
137
newArgs . port = parseInt ( options . port , 10 ) ;
141
138
newArgs . db = parseInt ( options . database , 10 ) ;
142
139
newArgs . auth_pass = options . password ;
140
+ newArgs . password = options . password ;
143
141
if ( options . query && options . query . ttl ) {
144
142
newArgs . ttl = parseInt ( options . query . ttl , 10 ) ;
145
143
}
@@ -185,6 +183,10 @@ function redisStore(args) {
185
183
options = { } ;
186
184
}
187
185
186
+ if ( ! self . isCacheableValue ( value ) ) {
187
+ return cb ( new Error ( 'value cannot be ' + value ) ) ;
188
+ }
189
+
188
190
options = options || { } ;
189
191
190
192
var ttl = ( options . ttl || options . ttl === 0 ) ? options . ttl : redisOptions . ttl ;
@@ -193,7 +195,7 @@ function redisStore(args) {
193
195
if ( err ) {
194
196
return cb && cb ( err ) ;
195
197
}
196
- var val = JSON . stringify ( value ) ;
198
+ var val = JSON . stringify ( value ) || '"undefined"' ;
197
199
if ( ttl ) {
198
200
conn . setex ( key , ttl , val , handleResponse ( conn , cb ) ) ;
199
201
} else {
0 commit comments