# Caching

Source: https://zshot-cli.com/reference/server/caching/
Markdown: https://zshot-cli.com/reference/server/caching/index.md
Section: [Reference](https://zshot-cli.com/reference/) › [Server](https://zshot-cli.com/reference/server/)

[`--server-cache`](/reference/flags/server/server-cache) stores successful renders on disk and answers repeat GETs from the store.

## Keys

An entry's key combines the server's startup arguments with the request's URL and render parameters. Restarting with different arguments leaves earlier entries unreachable. The signature is not part of the key, so a signed GET and an unsigned POST for the same render share one entry. MCP requests are never cached.

## Reads and Writes

A `GET /` is served from a fresh entry when one exists. A `POST /` always renders, then writes its result over any entry for later GETs. An entry stays fresh for [`--server-cache-ttl`](/reference/flags/server/server-cache-ttl) seconds; the oldest entries are evicted once the store passes [`--server-cache-size-limit`](/reference/flags/server/server-cache-size-limit).

Each hit is checked against its stored digest; a mismatch evicts the entry and renders again. A cache error never fails a render.

## Response Headers

| Header | Value |
| --- | --- |
| `Cache-Control` | `public, max-age=<seconds of freshness left>` |
| `ETag` | the body's content digest |
| `Last-Modified` | when the entry was rendered |
| `Age` | seconds since then, on a hit |

A GET whose `If-None-Match` matches the `ETag`, or whose `If-Modified-Since` is at or after `Last-Modified`, answers `304`.

## Purging

`DELETE /` takes the same arguments as a render, as query parameters or a JSON body, and is authorized like a GET.

| Request | Response |
| --- | --- |
| arguments with a fresh entry | `204`; the entry expires |
| arguments with no fresh entry | `410` |
| no arguments | `204`; every entry expires |
| any, without `--server-cache` | `404` |

On a server with signed URLs and no credential auth, sign the DELETE's query; a JSON body carries no signature and is rejected.

## Related

Flags:

- [`--server-cache`](https://zshot-cli.com/reference/flags/server/server-cache/)
- [`--server-cache-ttl`](https://zshot-cli.com/reference/flags/server/server-cache-ttl/)
- [`--server-cache-size-limit`](https://zshot-cli.com/reference/flags/server/server-cache-size-limit/)

Topics:

- [Browser as a CDN](https://zshot-cli.com/examples/browser-as-a-cdn/)
- [Authentication](https://zshot-cli.com/reference/server/authentication/)
- [Conditional requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Conditional_requests) — MDN

## Navigation

- [Examples](https://zshot-cli.com/examples/)
- [Download](https://zshot-cli.com/download/)
- [Purchase](https://zshot-cli.com/purchase/)
- [Reference](https://zshot-cli.com/reference/)
  - [Formats](https://zshot-cli.com/reference/formats/)
  - [Flags](https://zshot-cli.com/reference/flags/)
  - [Agents](https://zshot-cli.com/reference/agents/)
  - [Configuration](https://zshot-cli.com/reference/configuration/)
  - [Crawling](https://zshot-cli.com/reference/crawling/)
  - [Docker](https://zshot-cli.com/reference/docker/)
  - [Exit Codes](https://zshot-cli.com/reference/exit_codes/)
  - [Linux](https://zshot-cli.com/reference/linux/)
  - [LLM Connections](https://zshot-cli.com/reference/llm_connections/)
  - [LLM Formatting](https://zshot-cli.com/reference/llm_formatting/)
  - [Local Inputs](https://zshot-cli.com/reference/inputs/)
  - [Navigator](https://zshot-cli.com/reference/navigator/)
  - [Security](https://zshot-cli.com/reference/security/)
  - [Server](https://zshot-cli.com/reference/server/)
    - [API](https://zshot-cli.com/reference/server/api/)
    - [Endpoints](https://zshot-cli.com/reference/server/endpoints/)
    - [Metrics](https://zshot-cli.com/reference/server/metrics/)
    - [Additional Assets](https://zshot-cli.com/reference/server/additional-assets/)
    - [Authentication](https://zshot-cli.com/reference/server/authentication/)
    - **Caching**
  - [Shell completions](https://zshot-cli.com/reference/shell_completions/)
  - [Storage](https://zshot-cli.com/reference/storage/)
  - [Timeouts](https://zshot-cli.com/reference/timeouts/)
  - [Web Bot Auth](https://zshot-cli.com/reference/web_bot_auth/)
- [Support](https://zshot-cli.com/support/)
- [Changelog](https://zshot-cli.com/changelog/)

Site index: https://zshot-cli.com/llms.txt

