lru-cache
Advanced tools
Comparing version 7.1.2 to 7.1.3
15
index.js
@@ -114,2 +114,3 @@ const perf = typeof performance === 'object' && performance && | ||
} | ||
this.keyMap = new Map() | ||
@@ -216,3 +217,3 @@ this.keyList = new Array(max).fill(null) | ||
while (this.calculatedSize > maxSize) { | ||
this.evict() | ||
this.evict(true) | ||
} | ||
@@ -395,3 +396,3 @@ this.calculatedSize += this.sizes[index] | ||
if (this.size === this.max) { | ||
return this.evict() | ||
return this.evict(false) | ||
} | ||
@@ -408,3 +409,3 @@ if (this.free.length !== 0) { | ||
const val = this.valList[this.head] | ||
this.evict() | ||
this.evict(true) | ||
return val | ||
@@ -414,3 +415,3 @@ } | ||
evict () { | ||
evict (free) { | ||
const head = this.head | ||
@@ -420,2 +421,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] | ||
@@ -422,0 +429,0 @@ this.keyMap.delete(k) |
{ | ||
"name": "lru-cache", | ||
"description": "A cache object that deletes the least-recently-used items.", | ||
"version": "7.1.2", | ||
"version": "7.1.3", | ||
"publishConfig": { | ||
@@ -25,3 +25,4 @@ "tag": "v7.1-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
34204
498
0
3