()
| 35 | constructor(private ttl: number) {} |
| 36 | |
| 37 | get(): T | null { |
| 38 | if (!this.entry) return null; |
| 39 | if (Date.now() - this.entry.fetchedAt > this.ttl) { |
| 40 | this.entry = null; |
| 41 | return null; |
| 42 | } |
| 43 | return this.entry.data; |
| 44 | } |
| 45 | |
| 46 | set(data: T): void { |
| 47 | this.entry = { data, fetchedAt: Date.now() }; |
nothing calls this directly
no outgoing calls
no test coverage detected