Skip to content

Commit a23d7d1

Browse files
Merge pull request #291 from manzt/manzt/fix-lru-cache
Replace `lru-cache` with `quick-lru`
2 parents 0e5902f + e20f1a5 commit a23d7d1

File tree

3 files changed

+35
-32
lines changed

3 files changed

+35
-32
lines changed

package-lock.json

Lines changed: 32 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
"dependencies": {
3232
"@petamoriken/float16": "^3.4.7",
3333
"lerc": "^3.0.0",
34-
"lru-cache": "^7.4.1",
3534
"pako": "^2.0.4",
3635
"parse-headers": "^2.0.2",
36+
"quick-lru": "^6.1.0",
3737
"web-worker": "^1.2.0",
3838
"xml-utils": "^1.0.2"
3939
},

src/source/blockedsource.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import LRUCache from 'lru-cache';
1+
import QuickLRU from 'quick-lru';
22
import { BaseSource } from './basesource.js';
33
import { AbortError, AggregateError, wait, zip } from '../utils.js';
44

@@ -48,7 +48,7 @@ export class BlockedSource extends BaseSource {
4848
this.source = source;
4949
this.blockSize = blockSize;
5050

51-
this.blockCache = new LRUCache({ max: cacheSize });
51+
this.blockCache = new QuickLRU({ maxSize: cacheSize });
5252

5353
// mapping blockId -> Block instance
5454
this.blockRequests = new Map();

0 commit comments

Comments
 (0)