Cache Optimization

Last update:2026-07-03 11:00:51

Cache Optimization lets you configure how CDN edge servers cache live streaming resources and how query strings are handled when matching cache keys and forwarding requests to origin.

Note: Cache Optimization is available only for delivery domains configured with origin-pull.

Configure cache rules

Cache rules define how long CDN edge servers cache matching resources. Rules are evaluated by priority; a higher priority value is matched first.

Add a cache rule

  1. Go to Configuration, select the target domain, and open the Cache Optimization settings.
  2. In Cache Rules, choose + Add.
  3. In the Cache Rules dialog, configure the rule.
Field Required Description
Apply to Yes Select the resource scope: Specific File Type, Specific Directory, or URL Pattern (Regex).
Cache TTL Yes Enter the cache duration and select the time unit.
Priority Yes Set the match priority. A higher value has higher priority. Default: 10.

After the rule is added, it appears in the Cache Rules list with its scope, cache TTL, and priority.

Choose the right scope

Use this table to decide which Scope option fits your use case:

Option Use case Input rule Example
Specific File Type Cache files by extension, regardless of path. Enter extensions without dots. Separate multiple extensions with semicolons. Use letters and numbers only. m3u8;ts;flv
Specific Directory Cache resources under one or more directory paths. Enter one directory path per line. Each path must start and end with /. /live/123/
URL Pattern (Regex) Cache resources that match a regular expression. Enter the path-matching part of the regular expression. Do not include the protocol or domain. live/.*\.(m3u8\|flv\|ts)($\|.*)

For URL Pattern (Regex), the platform automatically prepends ^https?://[^/]+/ to the pattern.

Configure query string rules

Query String rules control whether query parameters are included in the cache key and whether they are forwarded to origin. Use these rules when streaming URLs contain dynamic parameters that should not always create separate cached copies.

Add a query string rule

  1. Go to Configuration, select the target domain, and open the Cache Optimization settings.
  2. In Query String, choose + Add.
  3. In the Query String dialog, configure the scope and query string options.
  4. Choose Confirm.
Field Required Default Description
Apply to Yes - Select the resource scope: Specific File Type, Specific Directory, or URL Pattern (Regex).
Ignore Query String Yes Yes Select Yes to let URLs with different query strings share one cached copy. Select No to cache each unique query string separately.
Remove Query String from Origin Requests Yes Yes Select Yes to strip the query string before forwarding the request to origin. Select No to forward the query string to origin.
Case-Insensitive Match Yes Yes Select Yes to match URLs that differ only by letter case to the same rule.
Priority Yes 10 Set the match priority. A higher value has higher priority.

Query string handling examples

Goal Ignore Query String Remove Query String from Origin Requests
Share one cached copy across all query string variants and send a clean URL to origin. Yes Yes
Share one cached copy across all query string variants and send the full URL to origin. Yes No
Cache each query string variant separately and send a clean URL to origin. No Yes
Cache each query string variant separately and send the full URL to origin. No No

Default cache TTLs

The following TTLs are used when no matching Cache Rules entry applies to a request. Custom cache rules take precedence over these defaults.

Scope Cache TTL Notes
URLs with query strings (?) 10 min If the request includes a no-cache header, the cached copy is treated as expired and the CDN fetches from origin.
.cgi files 10 min Same no-cache behavior as above.
.mp3, .wma files 12-24 h Cache TTL follows the refresh configuration. Cache-Control: max-age and Expires headers from origin are ignored. no-cache request headers are also ignored.
FTP protocol requests 1-7 days Same refresh-configuration behavior as above.
Gopher protocol requests 0-24 h Same refresh-configuration behavior as above.
.shtml, .html, .htm, .js files 12 h -
.wmv files 24 h -
.gif, .swf, .png, .bmp files 24 h -
.mp4, .ts, .f4v, .f4vcrc, .7z, .apk, .wdf, .cab, .dhp, .exe, .flv, .gz, .ipa, .iso, .mpk, .MPQ, .pbcv, .pxl, .qnp, .r00, .rar, .xy, .xy2, .zip, .CAB 30 days -
All other files No default TTL -
Is the content of this document helpful to you?
Yes
I have suggestion
Submitted successfully! Thank you very much for your feedback, we will continue to strive to do better!