cache-manager
Advanced tools
Comparing version 4.0.0 to 4.0.1
@@ -0,1 +1,4 @@ | ||
- 4.0.1 | ||
- Fix TTL option bug for memory cache (#194). - @anchan828 | ||
- 4.0.0 | ||
@@ -2,0 +5,0 @@ - Upgrade to lru-cache 7.x (#193). - @orgads |
@@ -33,7 +33,6 @@ /*eslint no-unused-vars:0*/ | ||
var ttl = args.ttl; | ||
var lruOpts = { | ||
max: args.max || 500, | ||
maxSize: args.maxSize, | ||
ttl: (ttl || ttl === 0) ? ttl * 1000 : null, | ||
ttl: (args.ttl || args.ttl === 0) ? args.ttl * 1000 : undefined, | ||
dispose: args.dispose, | ||
@@ -48,7 +47,7 @@ sizeCalculation: args.sizeCalculation || args.length, | ||
var setMultipleKeys = function setMultipleKeys(keysValues, maxAge) { | ||
var setMultipleKeys = function setMultipleKeys(keysValues, ttl) { | ||
var length = keysValues.length; | ||
var values = []; | ||
for (var i = 0; i < length; i += 2) { | ||
lruCache.set(keysValues[i], keysValues[i + 1], maxAge); | ||
lruCache.set(keysValues[i], keysValues[i + 1], {ttl}); | ||
values.push(keysValues[i + 1]); | ||
@@ -70,5 +69,5 @@ } | ||
var maxAge = (options.ttl || options.ttl === 0) ? options.ttl * 1000 : lruOpts.maxAge; | ||
var ttl = (options.ttl || options.ttl === 0) ? options.ttl * 1000 : lruOpts.ttl; | ||
lruCache.set(key, value, maxAge); | ||
lruCache.set(key, value, {ttl}); | ||
if (cb) { | ||
@@ -94,5 +93,5 @@ process.nextTick(cb.bind(null, null)); | ||
var maxAge = (options.ttl || options.ttl === 0) ? options.ttl * 1000 : lruOpts.maxAge; | ||
var ttl = (options.ttl || options.ttl === 0) ? options.ttl * 1000 : lruOpts.ttl; | ||
var values = setMultipleKeys(args, maxAge); | ||
var values = setMultipleKeys(args, ttl); | ||
@@ -99,0 +98,0 @@ if (cb) { |
{ | ||
"name": "cache-manager", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "Cache module for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
81361
1631