Fix LRUCache eviction

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