Summary
Integrate Redis (or in-memory LRU cache) for caching frequently accessed API responses like agent listings, stats, and health checks.
Motivation
Every API request hits the SQLite database. Caching hot data reduces database load and improves response times for repeated queries.
Acceptance Criteria
Files to Modify
| File |
Action |
backend/src/api/middleware/cache.ts |
New: cache middleware |
backend/src/cache/index.ts |
New: cache client (LRU or Redis) |
backend/src/cache/invalidation.ts |
New: cache invalidation logic |
backend/src/api/routes/agents.ts |
Add cache middleware to GET endpoints |
backend/src/api/routes/stats.ts |
Add cache middleware |
backend/src/api/routes/health.ts |
Add cache middleware |
backend/src/config/index.ts |
Add cache configuration |
How to Contribute
- Create branch
feat/api-response-caching
- Implement LRU cache client (or Redis integration)
- Build cache middleware with TTL support
- Add cache invalidation to mutation endpoints
- Write unit tests for cache behavior
- Run
npm run test && npm run lint before submitting PR
Summary
Integrate Redis (or in-memory LRU cache) for caching frequently accessed API responses like agent listings, stats, and health checks.
Motivation
Every API request hits the SQLite database. Caching hot data reduces database load and improves response times for repeated queries.
Acceptance Criteria
api:{method}:{path}:{query_hash}X-Cache-BypassheaderFiles to Modify
backend/src/api/middleware/cache.tsbackend/src/cache/index.tsbackend/src/cache/invalidation.tsbackend/src/api/routes/agents.tsbackend/src/api/routes/stats.tsbackend/src/api/routes/health.tsbackend/src/config/index.tsHow to Contribute
feat/api-response-cachingnpm run test && npm run lintbefore submitting PR