docs
ucdn
User Guide
Cache Configuration

Cache Configuration

During CDN acceleration, the configuration of caching rules is very important. Configuring appropriate caching rules can achieve the effect of half the effort. Through this article, you can understand how to configure it and related considerations, etc.

I. Cache Rule Configuration

Operation Steps

  1. You can modify and set appropriate caching rules based on actual needs at the time of creating a domain name, which provides default cache rules.

  2. You can go to the domain name configuration details page, select Domain Name ConfigurationBasic SettingsCache Configuration → Modify Cache Rules, to do the corresponding configuration related to cache for a domain name.

Domain name creation:

Default caching rules:

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

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

If the acceleration type is: Full site acceleration
The default rule is:
1、All files are not cached, following the source station cache

Parameter Cache configuration

The retain or ignore parameter cache strategy can be configured in the cache configuration of the domain name configuration. If custom parameter effectiveness is required, please contact technical support for non-standard configuration.

Default parameter cache rules:

  If the acceleration type is: Page
  The default is parameter caching
 
  If the acceleration type is: Download/On-Demand
  Default removed parameter caching

Domain name configuration:

Click to configure cache rules, you can match and configure different website elements according to business needs, including remove parameter cache configuration.

When you finish the configuration at the domain name configuration, please make sure to click on Confirm Configuration to successfully modify the configuration.

Cache Configuration Item Explanation

Configuration ItemExplanation
Priority
  • Cache rule priority, strategy: from top to bottom.
  • By adjusting the cache rule order, set the cache rule priority.
  • Website Elements
  • Website elements refer to the file types that need to be set for caching, including web page files, image files, text files, etc.
  • Can be customized website element names through add new.
  • Path Template
  • After selecting the website element, the corresponding path template will be matched. Detailed explanation as below
  • Can customize path template through adding new, must start with /.
  • Can be file type, eg: /.html, can be directory file eg: /news/, can be a detailed path file eg: /news/image.jpg
  • Cache Time
  • The cache time corresponding to the resource, it is recommended that you 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 actual business conditions
  • For dynamic files (such as php, jsp, asp etc), it is recommended that you set the cache time to 0s, i.e. do not cache.
  • Whether to Cache
  • Whether to cache this rule according to the strategy set.
  • By default, dynamic files php, aspx, asp, jsp, do, dwr, cgi, fcgi, action, ashx, axd, json etc. do not cache, and have the highest priority.
  • Whether to Comply Source Station
  • Default is to comply with the source station. When complying with the source station, if the source station has set an expiry time, the source station's expiry time will be followed. If the source station has no expiry set, 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 under the root directory, /.(html|js) represents all html and js type files under the root directory
    
    7. The slash at the beginning /news/image.jpg represents the specific image.jpg file under the news directory, news(image.jpg|logo.jpg) represents the image.jpg and logo.jpg files under the news directory

    II. Special Status Code Cache

    Operation Steps

    The expiration time of the status code for the specified directory or file can be configured in the cache configuration of the domain name configuration.

    1、Enter the domain name configuration details page, choose Domain Name ConfigurationBasic SettingsCache Configuration → Special Status Code Cache, and proceed with configuration

    2、Add Status Code Cache

    Configuration Item Explanation:

    Configuration ItemExplanation
    Status Code
  • Status Code is for special status code cache, 2xx status code cache follows the configured cache strategy, 200 or 206, this cache strategy cannot be configured
  • Status Code default cache time is 0S.
  • Whether to Specify Directory or URL
  • Recognize the response status code cache of the specified directory or URL by default for all files.
  • Path
  • Specific path, default is /* represents all files
  • The path 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
  • Whether to Cache
  • Whether it is necessary to configure the cache, yes, then it is necessary to configure the corresponding cache time
  • Cache Time
  • Status code cache time, in seconds
  • Comply with Source Station
  • If you choose to comply with the source station, it will be based on the cache rules of the source station.
    • Company
    • ContactUs
    • Blog
    Copyright © 2024 SurferCloud All Rights Reserved