File tree Expand file tree Collapse file tree 2 files changed +123
-88
lines changed
Expand file tree Collapse file tree 2 files changed +123
-88
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ function redisStore(args) {
5757 * Helper to handle callback and release the connection
5858 * @private
5959 * @param {Object } conn - The Redis connection
60- * @param {Function } [cb] - A callback that returns a potential error and the resoibse
60+ * @param {Function } [cb] - A callback that returns a potential error and the result
6161 * @param {Object } [opts] - The options (optional)
6262 */
6363 function handleResponse ( conn , cb , opts ) {
@@ -73,7 +73,10 @@ function redisStore(args) {
7373 if ( opts . parse ) {
7474
7575 try {
76- result = JSON . parse ( result ) ;
76+ // allow undefined only if allowed by isCacheableValue
77+ if ( ! ( ( result === undefined || result === "undefined" ) && typeof args . isCacheableValue === 'function' && args . isCacheableValue ( result ) ) ) {
78+ result = JSON . parse ( result ) ;
79+ }
7780 } catch ( e ) {
7881 return cb && cb ( e ) ;
7982 }
@@ -124,10 +127,6 @@ function redisStore(args) {
124127 options = { } ;
125128 }
126129
127- if ( value === undefined ) {
128- return cb && cb ( new Error ( 'value cannot be undefined' ) ) ;
129- }
130-
131130 options = options || { } ;
132131
133132 var ttl = ( options . ttl || options . ttl === 0 ) ? options . ttl : redisOptions . ttl ;
You can’t perform that action at this time.
0 commit comments