nestjs-caching
Installation
SKILL.md
Caching & Redis Standards
Priority: P1 (OPERATIONAL)
Caching Strategy
- Layering: Use Multi-Level Caching for high-traffic read endpoints.
- L1 (Local): In-Memory (Node.js heap). Ultra-fast, no network. Use
lru-cachefor config/static data. - L2 (Distributed): Redis. Shared across pods.
- Pattern: Implement Stale-While-Revalidate to avoid latency spikes during cache misses.
NestJS Implementation
- Library: Use
cache-managerwithcache-manager-redis-yet(recommended overcache-manager-redis-storefor V4 stability). - Interceptors: Use
@UseInterceptors(CacheInterceptor)for simple GET responses. - Warning: Default key URL. Ensure consistent query param ordering or use custom key generators.