Location: server/src/utils/cache.ts
Description
High-traffic read endpoints such as GET /api/trades (marketplace listing) will be queried repeatedly by many users simultaneously. Without a caching layer, every request hits PostgreSQL, increasing latency and database load. A Redis-backed cache with TTL-based invalidation should be added for expensive read paths.
Acceptance Criteria
Location:
server/src/utils/cache.tsDescription
High-traffic read endpoints such as
GET /api/trades(marketplace listing) will be queried repeatedly by many users simultaneously. Without a caching layer, every request hits PostgreSQL, increasing latency and database load. A Redis-backed cache with TTL-based invalidation should be added for expensive read paths.Acceptance Criteria
ioredisis added as a dependency and a shared Redis client is initialised from aREDIS_URLenvironment variable.cache.get<T>(key)andcache.set<T>(key, value, ttlSeconds)utility is created inserver/src/utils/cache.ts.GET /api/trades(marketplace listing) caches the full response for 30 seconds, keyed by the serialised query params.debuglevel; cache misses are logged atinfolevel with the key.warn— it does not crash.