(key: string)
| 26 | } |
| 27 | |
| 28 | get<T>(key: string): T | null { |
| 29 | const item = this.cache.get(key); |
| 30 | if (!item) { |
| 31 | return null; |
| 32 | } |
| 33 | |
| 34 | const now = Date.now(); |
| 35 | if (now - item.timestamp > item.ttl) { |
| 36 | this.cache.delete(key); |
| 37 | return null; |
| 38 | } |
| 39 | |
| 40 | return item.data as T; |
| 41 | } |
| 42 | |
| 43 | delete(key: string): void { |
| 44 | this.cache.delete(key); |
no test coverage detected