(key: string)
| 19 | } |
| 20 | |
| 21 | get(key: string): T | undefined { |
| 22 | const entry = this.cache.get(key); |
| 23 | if (!entry) return undefined; |
| 24 | |
| 25 | if (Date.now() > entry.expiresAt) { |
| 26 | this.cache.delete(key); |
| 27 | return undefined; |
| 28 | } |
| 29 | |
| 30 | return entry.value; |
| 31 | } |
| 32 | |
| 33 | has(key: string): boolean { |
| 34 | return this.get(key) !== undefined; |