Skip to content

Cache GET /requests/:id with Redis #11

Description

@iexwr

Context

A request row is read frequently (dashboard polls, webhook consumers) but changes rarely. Hitting Postgres every time is wasteful.

Acceptance criteria

  • Cache the serialized request under req:<contract>:<id> with a configurable TTL (env CACHE_TTL, default 15s).
  • Invalidate the cache on write from the indexer (paid/cancelled).
  • Falls back to DB on cache miss / Redis error; never hard-fail.

Technical notes

  • Use the existing ioredis client.
  • Keep TTL short; state changes must reflect quickly.

Testing

  • Test that a cache hit returns DB data and a subsequent invalidation forces a refresh.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveStellar Wave for StackPayenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions