(key: string | null, value: unknown)
| 62 | } |
| 63 | |
| 64 | set(key: string | null, value: unknown): void { |
| 65 | if (key === null) return; |
| 66 | if (this.store.has(key)) this.store.delete(key); |
| 67 | this.store.set(key, value); |
| 68 | while (this.store.size > this.maxEntries) { |
| 69 | const oldestKey = this.store.keys().next().value; |
| 70 | if (oldestKey === undefined) break; |
| 71 | this.store.delete(oldestKey); |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | has(key: string | null): boolean { |
| 76 | return key !== null && this.store.has(key); |
no test coverage detected