* Get cached content if still valid
(userId: string)
| 29 | * Get cached content if still valid |
| 30 | */ |
| 31 | get(userId: string): HomeContent | null { |
| 32 | const entry = this.cache.get(userId); |
| 33 | if (!entry) return null; |
| 34 | |
| 35 | if (Date.now() > entry.expiresAt) { |
| 36 | this.cache.delete(userId); |
| 37 | return null; |
| 38 | } |
| 39 | |
| 40 | return entry.data; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Cache content for a user |
no test coverage detected