Skip to content

Implement deterministic ETag caching for GraphQL responses #413

Description

@Fatimasanusi

Description

Repeatedly querying the identical state of a fractional vault wastes database I/O and increases client wait times.

Architecture & Context

Aligning with GRAPHQL_IMPLEMENTATION.md, the backend must implement deterministic ETag generation. By hashing the current ledger sequence and the requested Vault ID, the Fastify server can return 304 Not Modified for unchanged data, leveraging browser-level caching.

Technical Requirements

  • Generate ETags using crypto.createHash('sha256') based on ledger state.
  • Intercept GraphQL requests to validate If-None-Match headers.
  • Bypass Prisma queries entirely if the ETag validates.

Acceptance Criteria

  • Unchanged vault queries return 304 Not Modified.
  • ETag generation adds less than 5ms overhead.
  • Database query volume drops by 40% under repeated polling.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions