lru-cache
Advanced tools
Comparing version 7.0.3 to 7.0.4
13
index.js
@@ -112,2 +112,3 @@ const perf = typeof performance === 'object' && performance && | ||
} | ||
this.keyMap = new Map() | ||
@@ -185,3 +186,3 @@ this.keyList = new Array(max).fill(null) | ||
while (this.calculatedSize > maxSize) { | ||
this.evict() | ||
this.evict(true) | ||
} | ||
@@ -341,3 +342,3 @@ this.calculatedSize += this.sizes[index] | ||
if (this.size === this.max) { | ||
return this.evict() | ||
return this.evict(false) | ||
} | ||
@@ -351,3 +352,3 @@ if (this.free.length !== 0) { | ||
evict () { | ||
evict (free) { | ||
const head = this.head | ||
@@ -357,2 +358,8 @@ const k = this.keyList[head] | ||
this.removeItemSize(head) | ||
// if we aren't about to use the index, then null these out | ||
if (free) { | ||
this.keyList[head] = null | ||
this.valList[head] = null | ||
this.free.push(head) | ||
} | ||
this.head = this.next[head] | ||
@@ -359,0 +366,0 @@ this.keyMap.delete(k) |
{ | ||
"name": "lru-cache", | ||
"description": "A cache object that deletes the least-recently-used items.", | ||
"version": "7.0.3", | ||
"version": "7.0.4", | ||
"publishConfig": { | ||
@@ -25,3 +25,4 @@ "tag": "v7.0-backport" | ||
"benchmark": "^2.1.4", | ||
"tap": "^15.1.6" | ||
"heapdump": "^0.3.15", | ||
"tap": "^16.0.1" | ||
}, | ||
@@ -36,4 +37,7 @@ "license": "ISC", | ||
"tap": { | ||
"coverage-map": "map.js" | ||
"coverage-map": "map.js", | ||
"node-arg": [ | ||
"--expose-gc" | ||
] | ||
} | ||
} |
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
29758
438
0
3