(key: string)
| 8 | ) {} |
| 9 | |
| 10 | get(key: string): T | null { |
| 11 | const entry = this.cache.get(key); |
| 12 | if (!entry) return null; |
| 13 | if (Date.now() - entry.fetchedAt > this.ttl) { |
| 14 | this.cache.delete(key); |
| 15 | return null; |
| 16 | } |
| 17 | return entry.data; |
| 18 | } |
| 19 | |
| 20 | set(key: string, data: T): void { |
| 21 | this.cache.set(key, { data, fetchedAt: Date.now() }); |
no outgoing calls
no test coverage detected