> For the complete documentation index, see [llms.txt](https://www.axisnow.io/zh/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.axisnow.io/zh/docs/edge/policies/cache/purge-and-warming.md).

# 缓存清理与预热

缓存清理的匹配方式与生效时间以及预热的执行方式

清理和预热是策略下的两个独立入口，不走规则集；提交后分发到全部边缘节点，各节点独立执行，洞察页可查看每次任务的状态和明细。

## 清理 <a href="#purge" id="purge"></a>

<table data-search="false"><thead><tr><th width="100">类型</th><th>匹配</th><th width="220">示例</th></tr></thead><tbody><tr><td>URL</td><td>域名加路径，不区分协议、查询参数和大小写：一条 URL 覆盖 http 与 https 以及所有参数变体</td><td><code>https://www.example.com/a.jpg</code></td></tr><tr><td>目录</td><td>路径前缀，以 <code>/</code> 结尾，最多 10 层</td><td><code>www.example.com/images/</code></td></tr><tr><td>域名</td><td>整个域名，或 <code>*.</code> 开头的泛域名</td><td><code>*.example.com</code></td></tr><tr><td>标签</td><td>带该标签的全部端点</td><td></td></tr><tr><td>全部</td><td>租户下所有缓存</td><td></td></tr></tbody></table>

每次最多提交 1000 条。

清理是标记失效而不是删除文件：节点收到任务后，早于任务时间的副本在下一次被请求时视为过期，重新回源校验，响应状态为 `EXPIRED`，源站确认内容未变时为 `REVALIDATED`。任务到达节点后 3 秒内生效，验证方法是再请求一次：`X-Cache` 不再是 `HIT`，且响应带 `X-Timestamp`。分片缓存的大文件所有分片一起失效。

先在源站发布新内容再清理：清理后的第一次请求回源校验，源站内容未变、返回 304 时旧副本续期。清理只作用于边缘，浏览器已缓存的副本要等它自己过期，所以会频繁更新的内容不要给浏览器设长时长。

## 预热 <a href="#warming" id="warming"></a>

提交完整 URL（含协议），每次最多 1000 条，也可上传 CSV。每个节点每 10 秒领取一次任务，各自向本机发起请求把内容拉进自己的缓存；节点之间不共享，新增节点需要重新预热。http 与 https 是两份副本，只预热提交的那个协议。

* 是否写入缓存仍由缓存控制的规则决定，URL 没有命中可缓存规则就不会被缓存。
* 返回 200 或 206 视为成功；跟随一次 301、302 或 307 重定向；5xx 共尝试 3 次。
* 可压缩的内容（文本、脚本、样式、字体等）会按 gzip、br、deflate 各预热一份，与客户端不同的压缩协商对应。
* 预热请求不经过[通用访问控制](/zh/docs/edge/policies/access-control.md)。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.axisnow.io/zh/docs/edge/policies/cache/purge-and-warming.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
