(key: string)
| 11 | private cache: Record<string, CacheEntry> = {}; |
| 12 | |
| 13 | async get(key: string): Promise<unknown | null> { |
| 14 | const entry = this.cache[key]; |
| 15 | if (entry) { |
| 16 | if (entry.ttl && entry.lastModified + entry.ttl * 1000 < Date.now()) { |
| 17 | // If the entry is expired, delete it and return null |
| 18 | await this.delete(key); |
| 19 | return null; |
| 20 | } |
| 21 | return JSON.parse(entry.value); |
| 22 | } |
| 23 | return null; |
| 24 | } |
| 25 | |
| 26 | async set( |
| 27 | key: string, |