()
| 42 | } |
| 43 | |
| 44 | private cleanup(): void { |
| 45 | const now = Date.now(); |
| 46 | for (const [key, entry] of this.cache.entries()) { |
| 47 | if (now - entry.timestamp > this.ttl) { |
| 48 | this.cache.delete(key); |
| 49 | } |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | set(key: K, value: V): void { |
| 54 | // Remove oldest entry if we're at capacity |