cache-manager-redis-store
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -482,5 +482,5 @@ 'use strict'; | ||
} | ||
return _context.abrupt("return", redisCache.setEx(key, ttl, getValue(value))); | ||
return _context.abrupt("return", redisCache.setEx(key, ttl, encodeValue(value))); | ||
case 7: | ||
return _context.abrupt("return", redisCache.set(key, getValue(value))); | ||
return _context.abrupt("return", redisCache.set(key, encodeValue(value))); | ||
case 8: | ||
@@ -514,3 +514,3 @@ case "end": | ||
case 5: | ||
return _context2.abrupt("return", options.parse !== false ? JSON.parse(val) : val); | ||
return _context2.abrupt("return", options.parse !== false ? decodeValue(val) : val); | ||
case 6: | ||
@@ -533,4 +533,7 @@ case "end": | ||
case 0: | ||
if (isObject(args.at(-1))) { | ||
args.pop(); | ||
} | ||
return _context3.abrupt("return", redisCache.del(args)); | ||
case 1: | ||
case 3: | ||
case "end": | ||
@@ -548,3 +551,2 @@ return _context3.stop(); | ||
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(args) { | ||
var _options, _options2; | ||
var options, ttl, items, multi, _iterator, _step, kv, _kv, key, value; | ||
@@ -555,6 +557,7 @@ return _regeneratorRuntime().wrap(function _callee4$(_context4) { | ||
case 0: | ||
options = {}; | ||
if (isObject(args.at(-1))) { | ||
options = args.pop(); | ||
} | ||
ttl = (_options = options) !== null && _options !== void 0 && _options.ttl || ((_options2 = options) === null || _options2 === void 0 ? void 0 : _options2.ttl) === 0 ? options.ttl : config.ttl; // Zips even and odd array items into tuples | ||
ttl = options.ttl || options.ttl === 0 ? options.ttl : config.ttl; // Zips even and odd array items into tuples | ||
items = args.map(function (key, index) { | ||
@@ -566,3 +569,3 @@ if (index % 2 !== 0) return null; | ||
} | ||
return [key, getValue(value)]; | ||
return [key, encodeValue(value)]; | ||
}).filter(function (key) { | ||
@@ -572,3 +575,3 @@ return key !== null; | ||
if (!ttl) { | ||
_context4.next = 10; | ||
_context4.next = 11; | ||
break; | ||
@@ -590,5 +593,5 @@ } | ||
return _context4.abrupt("return", multi.exec()); | ||
case 10: | ||
case 11: | ||
return _context4.abrupt("return", redisCache.mSet(items)); | ||
case 11: | ||
case 12: | ||
case "end": | ||
@@ -627,3 +630,3 @@ return _context4.stop(); | ||
} | ||
return options.parse !== false ? JSON.parse(val) : val; | ||
return options.parse !== false ? decodeValue(val) : val; | ||
}); | ||
@@ -655,2 +658,5 @@ })); | ||
} | ||
if (isObject(args.at(-1))) { | ||
args.pop(); | ||
} | ||
if (Array.isArray(args)) { | ||
@@ -660,3 +666,3 @@ args = args.flat(); | ||
return _context6.abrupt("return", redisCache.del(args)); | ||
case 3: | ||
case 5: | ||
case "end": | ||
@@ -833,5 +839,8 @@ return _context6.stop(); | ||
}; | ||
function getValue(value) { | ||
function encodeValue(value) { | ||
return JSON.stringify(value) || '"undefined"'; | ||
} | ||
function decodeValue(val) { | ||
return JSON.parse(val); | ||
} | ||
function isObject(object) { | ||
@@ -838,0 +847,0 @@ return _typeof(object) === 'object' && !Array.isArray(object) && object !== null; |
@@ -5,3 +5,3 @@ { | ||
"description": "Redis store for node-cache-manager", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "main": "dist/index.js", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
37707
852
0