fix: production build

This commit is contained in:
Ren Amamiya
2026-04-08 12:57:04 +07:00
parent 72b9dcddc1
commit 4050afe93f
14 changed files with 1944 additions and 1676 deletions

View File

@@ -1,38 +1,38 @@
export class LRUCache {
constructor(maxSize) {
this.maxSize = maxSize;
this.map = new Map();
this.keys = [];
this.maxSize = maxSize
this.map = new Map()
this.keys = []
}
clear() {
this.map.clear();
this.map.clear()
}
has(k) {
return this.map.has(k);
return this.map.has(k)
}
get(k) {
const v = this.map.get(k);
const v = this.map.get(k)
if (v !== undefined) {
this.keys.push(k);
this.keys.push(k)
if (this.keys.length > this.maxSize * 2) {
this.keys.splice(-this.maxSize);
this.keys.splice(-this.maxSize)
}
}
return v;
return v
}
set(k, v) {
this.map.set(k, v);
this.keys.push(k);
this.map.set(k, v)
this.keys.push(k)
if (this.map.size > this.maxSize) {
this.map.delete(this.keys.shift());
this.map.delete(this.keys.shift())
}
}
}