Speed up lru cache splice
This commit is contained in:
+1
-1
@@ -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",
|
||||||
|
|||||||
@@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user