lru-cache
Advanced tools
Comparing version 7.3.2 to 7.3.3
15
index.js
@@ -115,2 +115,3 @@ const perf = typeof performance === 'object' && performance && | ||
} | ||
this.keyMap = new Map() | ||
@@ -224,3 +225,3 @@ this.keyList = new Array(max).fill(null) | ||
while (this.calculatedSize > maxSize) { | ||
this.evict() | ||
this.evict(true) | ||
} | ||
@@ -412,3 +413,3 @@ this.calculatedSize += this.sizes[index] | ||
if (this.size === this.max) { | ||
return this.evict() | ||
return this.evict(false) | ||
} | ||
@@ -425,3 +426,3 @@ if (this.free.length !== 0) { | ||
const val = this.valList[this.head] | ||
this.evict() | ||
this.evict(true) | ||
return val | ||
@@ -431,3 +432,3 @@ } | ||
evict () { | ||
evict (free) { | ||
const head = this.head | ||
@@ -441,2 +442,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] | ||
@@ -443,0 +450,0 @@ this.keyMap.delete(k) |
{ | ||
"name": "lru-cache", | ||
"description": "A cache object that deletes the least-recently-used items.", | ||
"version": "7.3.2", | ||
"version": "7.3.3", | ||
"publishConfig": { | ||
@@ -25,3 +25,4 @@ "tag": "v7.3-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
36651
549
0
3