tencent cloud

Feedback

Cache Configuration

Last updated: 2021-08-12 10:18:01
This document is currently invalid. Please refer to the documentation page of the product.

    Features

    ECDN can automatically identify static and dynamic content access requests based on the configured rules and intelligently apply an appropriate acceleration scheme, satisfying your needs for accelerating access to sites with static, dynamic or hybrid content at one stop.

    • For static content requests, the edge servers are preferentially used to cache the content for response, improving access efficiency and reducing origin-pull traffic usage.
    • For dynamic content requests, resources are directly pulled from the origin servers through high-quality origin-pull and intelligent routing, lowering the average response latency.
    Note:

    If your application has been migrated to the CDN console, you can go to the console for operation by referring to Content Delivery Network.

    Directions

    1. Log in to the ECDN Console and click Domain Management on the left sidebar to enter the management page.
    2. In the list, find the domain name to configure and click Manage under the "Operation" column on the right to enter the domain management page.
    3. On the "Cache Configuration" page, you can configure the content caching rules.
      • Ignore Query String cache configuration:
        You can enable Ignore Query String cache to ignore parameters after "?" in a user request URL during caching. Suppose that content of the URL http://www.example.com/1.jpg?version=1.1 is cached on nodes. When a user request comes in the cache, the cache_key www.example.com/1.jpg will be looked up to return a direct hit.
      • Content cache configuration:
        Click Edit Cache Rule to add a caching rule or modify an existing one and click Save for the rule to take effect.

    Caching rule types

    Cache Type Description Example Remarks
    File type Sets the caching time based on file extension .jpg;.png;.jsp 1. The content is case-sensitive and must be a file extension starting with ..
    2. Different file extensions should be separated with ;.
    Folder Sets the caching time based on folder /access;/pic 1. The content is case-sensitive, and different paths should be separated with ;.
    2. It must be a folder starting with /.
    3. It cannot end with /.
    Full-path file Sets the caching time for a specified file /a.jpg;/b.png 1. The content is case-sensitive, and files at different paths should be separated with ;.
    2. * can be used to match a type of files by regex, such as /test/abc/*.jpg.
    3. It must be a folder starting with /.
    Homepage Sets the caching time for the homepage / The homepage content to cache is / by default and does not need to be modified.

    Cache purge time

    Description

    • Cache purge time can be set by second, minute, hour, and day (up to 365 days).
    • If the cache purge time is 0, requests from the dynamic content will be directly passed through to the origin server, and the response content will not be cached.
    • If the cache purge time is greater than 0, requests come from the static content, and the edge caching feature will be enabled:
      • If the content accessed by the user has been cached on the edge server and the cache has not expired, the cached content can be directly accessed without making a request to the origin server.
      • If the content accessed by the user has not been cached on the edge server or the cache has expired, the content will be accessed after making a request to the origin server, and then will be cached on the edge server.

    Suggested setting

    File Type Scenario Example Recommended Caching Time
    Basically unchanged static content Images and audio/video files Set the cache purge time to 30 days.
    Static content that needs updates Files in formats such as .js and .css Set the caching time of days or hours based on the update frequency.
    Dynamic content that is frequently updated and shared by users Weather queries and region-specific content Set the caching time of minutes or seconds.
    Content that is dynamically generated or cannot be accessed repeatedly by the same user User registration and login APIs Set the caching time to 0 to disable caching.

    Caching rule priority

    You may get more than one hit result at the same time due to overlaps between caching rules you defined. Given this possibility, the setting of caching rule priority is included.

    • Rules at the bottom of the configuration list take priority over those on the top. A new caching rule takes the highest priority.
    • A user request will be matched with caching rules by rule priority from high to low. The first hit rule determines the cache purge time of the request.
    • You can adjust the priority of rules as needed.

    Click Edit Cache Rule. You can drag the icon to change the rule priority.

    Cache Inheritance

    If you configure edge caching for static content, the ECDN system will handle static requests with the caching rules configured. ECDN nodes will not inherit and process the Cache-Control field in the response header from the origin server by default, and will not cache the content if this field is private, no-store or no-cache.

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support