-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Context
The API currently has no HTTP caching — every request hits PostgreSQL directly. The mobile app polls every 60 seconds in the foreground, meaning frequent identical queries.
Proposed Change
Add caching headers to read endpoints:
| Endpoint | Strategy | TTL |
|---|---|---|
GET /api/v1/disasters |
Cache-Control: public, max-age=30 |
30s |
GET /api/v1/disasters/near |
Cache-Control: public, max-age=30 |
30s |
GET /api/v1/disasters/:id |
ETag based on updated_at |
Revalidate |
GET /healthz |
Cache-Control: no-cache |
— |
This reduces database load and improves mobile app responsiveness. Short TTLs (30s) still provide near-real-time data while cutting redundant queries.
Future
Consider Redis for query-level caching when traffic warrants it.
Labels
enhancement, performance
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels