NestJS Redis caching: cache-manager traps, measured

Caching a 50 millisecond NestJS route with cache-manager and Redis raised it from 935 to about 12,000 requests per second in our lab.

We reproduced six traps: TTL counted in milliseconds, CacheInterceptor leaking one user data to another, cache stampedes, memory versus Redis serialization differences, shared-object mutation and a

Use cache.wrap for expensive keys, key per user with trackBy, write TTLs in milliseconds and test against Redis, not the default memory store.

Read the full post

Read the full post