Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

array-lru

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-lru - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

18

index.js

@@ -21,3 +21,3 @@ var hash = require('./crc16')

this.size = this.buckets * this.collisions
this.indexedValues = !!opts.indexedValues
this.wrap = !opts.indexedValues
this.cache = new Array(this.size)

@@ -39,3 +39,3 @@ this.hash = this.buckets === 65536 ? hash : maskedHash(this.buckets - 1)

// no exiting version, but we have space to store it
page = this.cache[ptr] = this.indexedValues ? val : new Node(index, val)
page = this.cache[ptr] = this.wrap ? new Node(index, val) : val
move(this.cache, pageStart, ptr, page)

@@ -47,4 +47,4 @@ return

// update existing version and move to head of bucket
if (this.indexedValues) this.cache[ptr] = val
else page.value = val
if (this.wrap) page.value = val
else this.cache[ptr] = val
move(this.cache, pageStart, ptr, page)

@@ -58,9 +58,9 @@ return

// bucket is full, update oldest (last element in bucket)
if (this.indexedValues) {
if (this.evict) this.evict(page.index, page)
this.cache[ptr - 1] = val
} else {
if (this.wrap) {
if (this.evict) this.evict(page.index, page.value)
page.index = index
page.value = val
} else {
if (this.evict) this.evict(page.index, page)
this.cache[ptr - 1] = val
}

@@ -84,3 +84,3 @@ move(this.cache, pageStart, ptr - 1, page)

return this.indexedValues ? page : page.value
return this.wrap ? page.value : page
}

@@ -87,0 +87,0 @@

{
"name": "array-lru",
"version": "1.1.0",
"version": "1.1.1",
"description": "A really fast LRU cache for array items (numeric keys)",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc