How does a cache miss query the database and refill Redis?

Short answer

In this architecture, the API Server connects to Redis with a read-through path and to PostgreSQL with SQL. A cache miss follows the API-to-database path for the source data, then the application can write the result back to Redis.

The diagram proves those authored module connections, not production timeout values, cache-stampede locking, or an SLA.

Interactive diagram & verified source

The status and digests below come directly from the Gallery manifest, bound to ID web-app.

Automated checks

9/9 passed

Composition

pass · 0 errors · 0 warnings

Original export SHA-2569cf38fa8500c
Source JSON SHA-256490b72be25ad

The artifact digest hashes the standalone export before the site publication metadata block is inserted; the JSON source is served byte-identical.

Open the offline interactive artifact · Inspect the JSON source

How to read the path

1. Reach the application

Users connect to CloudFront over HTTPS, then CloudFront connects to the Load Balancer, and the Load Balancer connects to the API Server. The cache lookup belongs behind the API in this topology; the diagram does not claim that CloudFront itself is the Redis cache.

2. Read Redis, then use the SQL path on a miss

The API Server has a Redis connection labeled read-through and a separate PostgreSQL connection labeled SQL. Read those as the two relevant data paths: consult Redis first, and use PostgreSQL when the requested value is absent. The JSON does not contain a conditional branch or request trace, so the miss decision is an interpretation of the read-through contract rather than an observed execution.

3. Refill Redis through the application

No cache-write arrow is drawn separately from the bidirectional API-to-Redis relationship. The safe conclusion is that the API owns cache access and can refill Redis after obtaining data from PostgreSQL; the exact write command, TTL, serialization, and failure handling are not specified.

What this proves — and what it does not

  • Direct evidence: ten components, nine connections, the Redis read-through label, and the PostgreSQL SQL label in the architecture JSON.
  • Not proved: production cache-hit ratio, database latency, request timeout, TTL policy, retry behavior, or a service-level objective.
  • Not proved: a cache-stampede lock, single-flight behavior, stale-while-revalidate, or protection against concurrent refills. Those require implementation code or runtime evidence.
  • SQS and Worker are present for asynchronous jobs, but no edge in this source connects them to the cache-miss response path.

Reuse with your agent

Give this prompt and your diagram choice to an agent; require it to read the real input and list unknowns before drawing.

Use this web-app architecture as the source of truth. Draw the cache-miss read path from API Server to Redis, then API Server to PostgreSQL, and show the API refilling Redis. Label the refill as an application behavior inferred from read-through, and list TTL, locking, timeout, and retry policy as unknowns rather than inventing them.
Cite this answer in Markdown
[Cache miss flow: Redis to PostgreSQL and back](https://archify.si/cases/cache-miss-flow)

Archify task answer with a verified source-backed diagram.

Start with the architecture diagram type →