Performance: Cache stores (memory, Redis)
HIGH IMPACT
This affects how fast data can be retrieved and reduces server processing time, improving response speed and user experience.
async getUser(id: string) { const cached = await this.cacheManager.get(id); if (cached) return cached; const user = await this.userService.findById(id); await this.cacheManager.set(id, user, { ttl: 300 }); return user; }
async getUser(id: string) { return await this.userService.findById(id); // Always fetches from DB }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| No cache (DB fetch every time) | N/A | N/A | High server delay causes slow paint | [X] Bad |
| In-memory cache store | N/A | N/A | Fast response reduces paint delay | [OK] Good |
| Redis cache store | N/A | N/A | Fast network cache reduces paint delay | [OK] Good |