# Learn the system design (https://lazy-layers-cache.vercel.app/docs/learn)

> Understand the cache in the order you will use and operate it.



If you have not run a cache yet, start with the [quickstart](/docs/quickstart). This reading path explains the decisions behind it. You can stop after the first three pages and return to the rest when your application needs them.

## Understand the read and write path [#understand-the-read-and-write-path]

<Steps>
  <Step title="Follow one request">
    Read the [walkthrough](/docs/walkthrough). Follow a cold key into L1 and L2, see how peers receive its value, and invalidate it after a database update.
  </Step>

  <Step title="Choose what to keep close and what to share">
    Read [layers](/docs/concepts/layers). L1 avoids a network hop but belongs to one process. Redis L2 shares values between instances. TTLs and memory limits decide how long each layer retains them.
  </Step>

  <Step title="Keep cached data fresh enough">
    Read [invalidation](/docs/concepts/invalidation). Commit writes before invalidating, choose keys you can invalidate precisely, and account for delayed or missed events.
  </Step>
</Steps>

## Answer the next operational question [#answer-the-next-operational-question]

| Question                                     | Read                                                    | What you will learn                                                      |
| -------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------------------------ |
| What happens when many callers miss at once? | [Stampede protection](/docs/guides/stampede-protection) | Local in-flight dedupe, Redis leases, and contention deadlines           |
| What if Redis or the origin is unavailable?  | [Failure handling](/docs/guides/failure-handling)       | Fail-open paths, stale fallback, and errors callers still need to handle |
| How much memory can the cache retain?        | [Production setup](/docs/setups/production)             | Entry limits, shared byte budgets, and pressure-aware admission          |
| Can a late event overwrite a newer value?    | [Event ordering](/docs/architecture/event-ordering)     | Generation checks, duplicate filtering, and their limits                 |
| Which event bus fits my deployment?          | [Event buses](/docs/guides/event-buses)                 | Live delivery, durable subscriptions, and reconnect behavior             |
| Which encoding should I use?                 | [Serialization](/docs/concepts/serialization)           | Encoded L1 values, compression costs, and per-layer codecs               |
| How do I see what is happening?              | [Observability](/docs/guides/observability)             | The dashboard, metrics, and event stream                                 |

## Keep cache coordination and business operations separate [#keep-cache-coordination-and-business-operations-separate]

`getOrSet` loaders should read data. A Redis cache lease reduces duplicate work, but failures, expiry, and retries mean it does not provide exactly-once execution.

For durable operation coordination, use the [transaction API](/docs/reference/transactions). It coordinates attempts through one Redis authority. Your database constraints, stable provider idempotency key, and recovery logic remain responsible for the business result.

## Where to next [#where-to-next]

* [Walkthrough](/docs/walkthrough) starts with one concrete request.
* [API reference](/docs/reference/api) answers method and return-value questions.
* [Configuration reference](/docs/reference/configuration) lists options when you are ready to tune.
