docs
ucdn
How Tos
Cache Configuration

Cache Configuration

During the CDN acceleration process, the configuration of cache rules is very important. Configuring appropriate cache rules can achieve twice the result with half the effort. Through this article, you can understand how to configure and related precautions, etc.

I. Cache Rule Configuration

Operation Steps

  1. You can modify the default cache rules provided when creating a domain according to your actual needs and set appropriate cache rules.

  2. You can enter the domain configuration details page and select Domain Name Configuration → Basic Settings → Cache Configuration → Modify cache rules to configure the cache related to the corresponding domain.

Default Cache Rules:

If the acceleration type is: Page
The default cache rules are:
1. The cache rules first follow the source station configuration. If the source station has no cache rules, then the following default cache rules are followed
2. Dynamic files: (php|aspx|asp|jsp|do|dwr|cgi|fcgi|action|ashx|axd|json) are not cached
3. All other files are cached for 30 days.
4. If the source station returns response header information: no-cache, no-store, then it is not cached.

If the acceleration type is: Download/On-demand
The default cache rules are:
1. All files are cached for 30 days, following the source station cache.

Parameter Cache Configuration

In the cache configuration of domain configuration, you can configure to retain or ignore parameter caching strategies. If you need to customize parameters, you need to contact technical support for non-standard configuration.

Default parameter caching rules:

  If the acceleration type is: Page
  Default with parameter caching
 
  If the acceleration type is: Download/On-demand
  Default without parameter caching

Domain Configuration:

Click on Configure Cache Rules to match and configure different website elements according to business needs, including removing parameter cache configuration.

After configuring and modifying the domain configuration, you must click Confirm Configuration to successfully modify the configuration.

Cache Configuration Item Description

Configuration ItemDescription
Priority
  • Cache rule priority, strategy: from top to bottom.
  • Set the priority of cache rules by adjusting the order of cache rules.
  • Website Elements
  • Website elements are the file types to be cached, including web page files, image files, text files, etc.
  • You can add and customize the name of the website elements.
  • Path Template
  • After selecting the website element, the corresponding path template will be matched. See below for detailed explanation
  • You can add and customize the path template, which must start with /.
  • It can be a file type, eg: /.html, it can be a directory file eg: /news/, it can be a detailed path file eg: /news/image.jpg
  • Cache Time
  • The cache time of the resource, we recommend you to configure according to the following rules
  • For static files that are not updated frequently (such as image types, application download types, etc.), it is recommended that you set the cache time to more than 1 month
  • For frequently updated static files (such as js, css, etc.), you can set it according to the actual business situation
  • For dynamic files (such as php, jsp, asp, etc.), it is recommended that you set the cache time to 0s, that is, do not cache.
  • Whether to Cache
  • Whether to cache this rule according to the set strategy.
  • By default, dynamic files such as php, aspx, asp, jsp, do, dwr, cgi, fcgi, action, ashx, axd, json, etc. are not cached, and have the highest priority.
  • Whether to Follow the Origin Site
  • By default, it follows the origin site. When following the origin site, if the origin site has set an expiration time, the expiration time of the origin site will be followed. If the origin site does not have an expiration setting, the set cache rule will be followed.
  • Path Template Explanation:

    1. The slash / represents the website homepage, /xx/ represents the homepage of the /xx/ subdirectory
    
    2. The slash at the beginning /news/* represents all files under the news directory
    
    3. /(news|xiao)/* represents all files under the news and xiao directories
    
    4. The slash at the beginning /* represents all files
    
    5. The slash at the beginning /*.jpg represents all jpg files, including all jpg files in subdirectories such as /xx/
    
    6. The slash at the beginning /.*(html) represents all html type files in the root directory, /.*(html|js) represents all html and js type files in the root directory
    
    7. The slash at the beginning /news/image.jpg represents the specific image.jpg file in the news directory, news(image.jpg|logo.jpg) represents the image.jpg and logo.jpg files in the news directory
    • Company
    • ContactUs
    • Blog
    Copyright © 2024 SurferCloud All Rights Reserved
    • Contact our sales to help your business.
    • Contact our sales to help your business.