Skip to content

Add HTTP caching headers (ETag / Cache-Control) #10

Description

@lukesmmr

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions