Socket
Socket
Sign inDemoInstall

lru-cache

Package Overview
Dependencies
0
Maintainers
1
Versions
134
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.12.0 to 7.12.1

18

index.js

@@ -367,4 +367,6 @@ const perf =

this.sizes = new ZeroArray(this.max)
this.removeItemSize = index =>
(this.calculatedSize -= this.sizes[index])
this.removeItemSize = index => {
this.calculatedSize -= this.sizes[index]
this.sizes[index] = 0
}
this.requireSize = (k, v, size, sizeCalculation) => {

@@ -390,3 +392,3 @@ if (!isPosInt(size)) {

}
this.addItemSize = (index, v, k, size) => {
this.addItemSize = (index, size) => {
this.sizes[index] = size

@@ -401,3 +403,3 @@ const maxSize = this.maxSize - this.sizes[index]

removeItemSize(index) {}
addItemSize(index, v, k, size) {}
addItemSize(index, size) {}
requireSize(k, v, size, sizeCalculation) {

@@ -575,2 +577,6 @@ if (size || sizeCalculation) {

size = this.requireSize(k, v, size, sizeCalculation)
// if the item doesn't fit, don't do anything
if (this.maxSize && size > this.maxSize) {
return this
}
let index = this.size === 0 ? undefined : this.keyMap.get(k)

@@ -587,3 +593,3 @@ if (index === undefined) {

this.size++
this.addItemSize(index, v, k, size)
this.addItemSize(index, size)
noUpdateTTL = false

@@ -606,3 +612,3 @@ } else {

this.valList[index] = v
this.addItemSize(index, v, k, size)
this.addItemSize(index, size)
}

@@ -609,0 +615,0 @@ this.moveToTail(index)

{
"name": "lru-cache",
"description": "A cache object that deletes the least-recently-used items.",
"version": "7.12.0",
"version": "7.12.1",
"author": "Isaac Z. Schlueter <i@izs.me>",

@@ -6,0 +6,0 @@ "keywords": [

@@ -117,2 +117,6 @@ # lru-cache

Attempting to add an item to the cache whose calculated size is
greater that this amount will be a no-op. The item will not be
cached, and no other items will be evicted.
Optional, must be a positive integer if provided. Required if

@@ -138,3 +142,5 @@ other size tracking features are used.

Requires `maxSize` to be set.
Requires `maxSize` to be set. If the resulting calculated size
is greater than `maxSize`, then the item will not be added to the
cache.

@@ -442,2 +448,5 @@ Deprecated alias: `length`

If the `size` (or return value of `sizeCalculation`) is greater
than `maxSize`, then the item will not be added to the cache.
Will update the recency of the entry.

@@ -444,0 +453,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc