(key: string)
| 3 | private data = new Map<string, CacheItem<T>>(); |
| 4 | |
| 5 | public get(key: string): T | undefined { |
| 6 | const item = this.data.get(key); |
| 7 | |
| 8 | if (item && item.expiryTime < new Date().getTime()) { |
| 9 | this.data.delete(key); |
| 10 | return undefined; |
| 11 | } |
| 12 | |
| 13 | return item?.data; |
| 14 | } |
| 15 | |
| 16 | public add(key: string, item: T, millisecondsToCache: number) { |
| 17 | this.data.set( |