tencent cloud

Tencent Cloud EdgeOne

Release Notes and Announcements
Release Notes
Security Announcement
Announcements
Product Introduction
Overview
Strengths
Use Cases
Comparison Between EdgeOne and CDN Products
Use Limits
Purchase Guide
Description of Trial Plan Experience Benefits
Free Plan Guide
Billing Overview
Billing Items
Subscriptions
Renewals
Instructions for overdue and refunds
Comparison of EdgeOne Plans
About "clean traffic" billing instructions
DDoS Protection Capacity Description
Getting Started
Choose business scenario
Quick access to website security acceleration
Quick deploying a website with Pages
Domain Service&Origin Configuration
Domain Service
HTTPS Certificate
Origin Configuration
Site Acceleration
Overview
Access Control
Smart Acceleration
Cache Configuration
File Optimization
Network Optimization
URL Rewrite
Modifying Header
Modify the response content
Rule Engine
Image&Video Processing
Speed limit for single connection download
DDoS & Web Protection
Overview
DDoS Protection
Web Protection
Bot Management
API Discovery(Beta)
Edge Functions
Overview
Getting Started
Operation Guide
Runtime APIs
Sample Functions
Best Practices
Pages
L4 Proxy
Overview
Creating an L4 Proxy Instance
Modifying an L4 Proxy Instance
Disabling or Deleting an L4 Proxy Instance
Batch Configuring Forwarding Rules
Obtaining Real Client IPs
Data Analysis&Log Service
Log Service
Data Analysis
Alarm Service
Site and Billing Management
Billing Management
Site Management
Version Management
General Policy
General Reference
Configuration Syntax
Request and Response Actions
Country/region and Corresponding Codes
Terraform
Overview
Installing and Configuring Terraform
Practical Tutorial
Automatic Warm-up/Cache Purge
Resource Abuse/hotlinking Protection Practical
HTTPS Related Practices
Acceleration Optimization
Scheduling Traffic
Data Analysis and Alerting
Log Platform Integration Practices
Configuring Origin Servers for Cloud Object Storage (Such As COS)
CORS Response Configuration
API Documentation
History
Introduction
API Category
Making API Requests
Site APIs
Acceleration Domain Management APIs
Site Acceleration Configuration APIs
Edge Function APIs
Alias Domain APIs
Security Configuration APIs
Layer 4 Application Proxy APIs
Content Management APIs
Data Analysis APIs
Log Service APIs
Billing APIs
Certificate APIs
Origin Protection APIs
Load Balancing APIs
Diagnostic Tool APIs
Custom Response Page APIs
API Security APIs
DNS Record APIs
Content Identifier APIs
Legacy APIs
Ownership APIs
Image and Video Processing APIs
Multi-Channel Security Gateway APIs
Version Management APIs
Data Types
Error Codes
FAQs
Product Features FAQs
DNS Record FAQs
Domain Configuration FAQs
Site Acceleration FAQs
Data and Log FAQs
Security Protection-related Queries
Origin Configuration FAQs
Troubleshooting
Reference for Abnormal Status Codes
Troubleshooting Guide for EdgeOne 4XX/5XX Status Codes
520/524 Status Code Troubleshooting Guide
521/522 Status Code Troubleshooting Guide
Tool Guide
Agreements
Service Level Agreement
Origin Protection Enablement Conditions of Use
TEO Policy
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

Content Cache Rules

PDF
Focus Mode
Font Size
Last updated: 2023-05-25 15:19:39

Overview

After a client initiates an HTTP request to an EdgeOne node, if the requested file is not found in the cache, EdgeOne initiates a request to the origin to obtain the latest version of the file. After the origin returns the requested file, EdgeOne caches the file based on the default cache policy and your custom rules (See Node Cache TTL. Cache rules take effect in the following order:



Note:
A cache rule takes effect only if the origin returns 200 or 206. If the origin returns 404, the node caches the status code for 10s, and other status codes are not cached.
1. Rules configured in the rule engine are first matches the file against the cache rules in the rule engine from top to bottom. If the file matches a cache rule in the rule engine, it is cached as per that rule.
2. If the file does not match any rule in the rule engine, it is cached as per the global cache policy specified in Site Acceleration. EdgeOne uses the global cache policy as the default cache policy. You can modify the default cache policy as needed.

Cache Rules

EdgeOne supports the following three types of cache policies:
Default cache policy: The default cache policy of EdgeOne. The default cache policy determines the cache time of a file on a node based on the Cache-Control header and other caching-related headers of the HTTP response.
No-cache policy: Rules are set in the rule engine to specify not to cache specified files or not to cache any files of the site. A no-cache policy is applicable to dynamic or frequently updated files.
Custom cache policy: A custom cache policy allows you to cache files for a custom period of time.
Note:
EdgeOne supports cold file eviction. If a file cached in an EdgeOne node has not been requested over a long period of time, EdgeOne may remove it from the node cache before the specified cache time expires.

Default cache policy

The following figure describes the default cache policy of EdgeOne:



The default cache policy allows an EdgeOne node to control the caching of the file based on the following cache rules:
1. When the HTTP response contains any of the following not-to-cache headers, the file is not cached:
Cache-Control:private
Cache-Control:no-store
Cache-Control:no-cache
2. When the HTTP response header contains any of the following to-cache headers, the file is cached for the period of time specified in the header:
Cache-Control:s-maxage
Cache-Control:max-age
Expires
If more than one of the preceding response headers exists at the same time, their precedence is as follows: s-maxage > max-age > Expires. The file is cached for the period of time specified by the header with the highest priority.
3. When the HTTP response does not contain any of the preceding caching-related headers, the caching action specified in the rule is performed:
Default cache policy:
If the HTTP response contains the Last-Modified header, the cache time is calculated by this formula: (Current time - Value of Last-Modified) × 0.1. If the result ranges from 10 to 3,600 seconds, the result is taken as the cache time. If the result is less than 10 seconds, 10 seconds is taken as the cache time. If the result is greater than 3,600 seconds, 3,600 seconds is taken as the cache time.
If the HTTP response does not contain the Last-Modified header, the cache time of a file is determined based on the default cache rules and the file extension. The following table describes the cache time of files with different extensions:
Table 1: Default cache time for different file types
File Type
Extension
Cache Time
Dynamic files
php, aspx, asp, jsp, do, dwr, cgi, fcgi, action, ashx, axd, and json
Do not cache the file
Static files
Images
jpg, png, jpeg, webp, gif, heif, heic, kpg, and ico
2 hours
Audio/Video
mp4, mp3, m3u8, ts, m4a, avi, m4s, and ogg
Webpages
html, js, and css
Packages
zip, 7z, tar, br, gz, rar, and bz2
Documents
doc, docx, xls, xlsx, pdf, ppt, and pptx
Applications
apk, exe, and bin
Others
vsv, iso, jar, swf, chunk, and atlas
Other files
N/A
Do not cache the file
No Cache: If the HTTP response does not contain any of the preceding caching-related headers, the file is not cached.
Custom cache policy: If the HTTP response does not contain any of the preceding caching-related headers, the file is cached for the cache time specified in the custom rule.

No-cache policy

If the no-cache policy is set for the EdgeOne rule engine or the entire site, the file is not cached regardless of whether the HTTP response contains the Cache-Control header or other caching-related headers.

Custom cache policy




A custom cache policy allows you to cache a file for a custom period of time, and enable or disable the force cache feature.
Enable force cache: Force cache is enabled by default. If force cache is enabled, EdgeOne caches the file for the custom period of time, regardless of whether the HTTP response contains the Cache-Control header or other caching-related headers.
Disable force cache: After you disable force cache, if the HTTP response contains any of the following not-to cache headers, the file is not cached:
Cache-Control:private
Cache-Control:no-store
Cache-Control:no-cache
If the HTTP response does not contain any of the preceding headers, EdgeOne caches the file for the custom period of time.

Learn More




Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback