Speed up lru cache splice

This commit is contained in:
Jon Staab
2023-12-11 12:26:03 -08:00
parent 1e2d806d25
commit d01b05e2a2
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "paravel", "name": "paravel",
"version": "0.4.14", "version": "0.4.15",
"description": "Yet another toolkit for nostr", "description": "Yet another toolkit for nostr",
"author": "hodlbod", "author": "hodlbod",
"license": "MIT", "license": "MIT",
+1 -1
View File
@@ -14,7 +14,7 @@ export class LRUCache<T, U> {
if (v !== undefined) { if (v !== undefined) {
this.keys.push(k as T) this.keys.push(k as T)
if (this.keys.length > this.maxSize) { if (this.keys.length > this.maxSize * 2) {
this.keys.splice(-this.maxSize) this.keys.splice(-this.maxSize)
} }
} }