> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/welcome/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/welcome/content-delivery-network/domain-management/add-a-cache-rule.md).

# Add a Cache Rule

Time-to-live (TTL) refers to the amount of time that an object is cached on Zenlayer CDN points of presence (POPs). When the TTL expires, requests that attempt to access the expired content are redirected to origin. You can add a cache rule for static contents based on file directories or file extensions.

## Procedures

1. Click one domain name in the domain list.
2. Go to **Cache Config** > **Add Policy** to add cache expiration policies.
3. Enable/disable **Ignored Cache** (Cache Without Parameter).

<div align="left"><figure><img src="/files/oJMQPBdyieszgZAMKOTR" alt="" width="375"><figcaption><p>Add a Cache Rule</p></figcaption></figure></div>

| Parameter   | Description                                                                                                                                                                                                                                                                                                                                                                                                     |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Type        | Select Directory, File Suffix or Full Website.Directory Add a cache rule for resources in a specific directory.File Suffix Add a cache rule for files with the same filename suffix.Full Website A default cache rule for the full site.                                                                                                                                                                        |
| Expire Time | Specify the TTL. The maximum TTL is one years. Refer to the following rules:A TTL of one month or longer is normally recommended for static files, such as images and application packages.A TTL of 7 days is normally recommended for static files that are frequently updated, such as JavaScript and CSS files.A TTL of 0 second is normally recommended for dynamic files, such as PHP, JSP, and ASP files. |
| Value range | Specify a weight for the cache rule.The weight indicates the priority of the cache rule. Valid values: 1 to 999. A larger value specifies a higher priority.                                                                                                                                                                                                                                                    |


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.console.zenlayer.com/welcome/content-delivery-network/domain-management/add-a-cache-rule.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
