Problem
@nestjs/cache-manager and cache-manager are listed in package.json but CacheModule is never configured in AppModule. Every request to dashboard stats, menu item listings, and public restaurant data hits PostgreSQL with a full query. As the number of restaurants and concurrent users grows, this creates unnecessary database load on data that changes infrequently.
Proposed Solution
- Configure
CacheModule.registerAsync() in AppModule with a Redis store and env-configurable TTL (CACHE_TTL)
- Apply
@UseInterceptors(CacheInterceptor) to:
GET /api/admin/dashboard (TTL: 60s)
- Public menu listing endpoint (TTL: 300s)
- Public restaurant info endpoint (TTL: 300s)
- Use
@CacheKey() with restaurant-scoped keys: restaurant:{id}:resource
- Call
cacheManager.del(key) in mutation service methods to invalidate on write
Acceptance Criteria
Problem
@nestjs/cache-managerandcache-managerare listed inpackage.jsonbutCacheModuleis never configured inAppModule. Every request to dashboard stats, menu item listings, and public restaurant data hits PostgreSQL with a full query. As the number of restaurants and concurrent users grows, this creates unnecessary database load on data that changes infrequently.Proposed Solution
CacheModule.registerAsync()inAppModulewith a Redis store and env-configurable TTL (CACHE_TTL)@UseInterceptors(CacheInterceptor)to:GET /api/admin/dashboard(TTL: 60s)@CacheKey()with restaurant-scoped keys:restaurant:{id}:resourcecacheManager.del(key)in mutation service methods to invalidate on writeAcceptance Criteria
restaurant:{id}:resourceconventionCACHE_TTLenv variable