tencent cloud

Feedback

Cache Purge

Last updated: 2024-09-18 15:26:11

    Overview

    When your resource content is cached to the EdgeOne edge node, during the cache validity period, users accessing the resource will be directly responded by the EdgeOne edge node without triggering a return to the origin. If your origin site updates the resource content at this time, in order to prevent users from still accessing the old resource files, you can manually clear the cached resources in all edge nodes by using the Cache Purge function. After the cache is cleared, when users access the resource, EdgeOne will follow the origin to obtain the latest resource for response.

    Quota Description

    Different billing plans have different quotas, please refer to: Comparison of EdgeOne Plans.

    Use Cases

    You may need to use this function in the following scenarios:
    Content update: When you have updated some resources on the origin, but the cache on EdgeOne has not expired, you may want to let the client user see the latest content immediately.
    Error fix: If there are some erroneous contents cached on EdgeOne from your origin, to avoid business risks, you need to purge these erroneous caches immediately to ensure that EdgeOne no longer provides the wrong content.
    Testing and debugging: When developing and debugging a website, you may need to frequently modify and test the content. To ensure that you see the latest modified content rather than the cached old version, you can use the clear the cache function.
    Emergency response: In some emergency situations, such as being attacked or releasing sensitive information, you need to remove the relevant content from EdgeOne immediately.
    Cache Rules adjustment: When you adjust or optimize the EdgeOne Cache Rules, you may need to purge the existing cache to ensure that the new Rules are Effective immediately.

    Support Type

    EdgeOne clear the cache support based on various types of purging, details as follows:
    Type
    Details
    URL
    Match the node cache resources of the URL, for example, https://www.example.com/path/foo.jpg.
    Directory
    Match the node cache resources of the directory, for example, https://www.example.com/path/.
    Hostname
    Match the node cache resources of the Hostname, for example, www.example.com. Do not support submitting URLs in the format of *.test.com, that is, the domain name cannot contain wildcards, and the corresponding subdomains need to be specified.
    Cache-Tag
    Cache-Tag refresh is a method for quickly refreshing node caches. It allows you to refresh relevant content based on specific cache tags. In your website or application, you need to set cache tags for relevant content, which can be achieved by adding the Cache-Tag header in the HTTP response from the origin server.
    After setting the cache tag, you can match the tag value of the Cache-Tag header in the HTTP response to clear the cache, for example, Cache-Tag: pic . When submitting a refresh, you can enter pic in the Tag(s) field to refresh all resources with the tag.
    Only applicable to the Enterprise plan.
    Cache-Tag usage instructions:
    The maximum header size is 6 KB.
    Multiple tags are separated by ",", a single tag does not exceed 128 characters, and the tag limitation is 1,000.
    Tags are case-insensitive, that is, Tag1 and tag1 will be recognized as the same tag.
    All Cache
    All cache resources of the site on the node.
    If a wildcard domain name (e.g., *.foo.example.com) is connected to the current site ( example.com), it is unable to take effect against all caches under the wildcard domain name. You need to submit separate tasks to clear the cache for each specific subdomain.
    EdgeOne Cache Purge is divided into direct deletion and mark as expired methods, as follows:
    URL Type and Cache-Tag Type are set to "directly delete" by default, which means directly deleting the cache content. When a user sends a request for resources, EdgeOne will immediately origin-pull the latest resources, increasing the number of origin-pull requests within a short time and weakening the acceleration effect. If a large amount of content is submitted, the origin will be under greater pressure.
    Other purge types are set to "mark as expired" by default, which means that the cache will not be directly deleted, but marked as expired. If the cache node has Last-Modified and Etag headers, the next time a user requests the resource, the node will carry If-None-Match and If-Modified-Since headers for origin-pull verification whether the resource has been updated. The response of 304 or 200 is determined by the origin, generally speaking:
    If there is no update - the origin returns 304 (Not Modified), then the node continues to use the cache to respond, effectively saving bandwidth;
    If there is an update - the origin returns 200 (OK), then the node collects the latest resources from the origin and compares the Last-Modified and Content-Length headers of the cached resources and the new resources. If either header value is different, the new resource will overwrite the expired cache on the node.
    Note:
    EdgeOne nodes differentiate cache based on the URL before and after encoding by default. Therefore, when refreshing, you need to submit them separately. If the URL contains special characters, then when submitting the URL refresh in the console:
    https://example.com/d/default_avatar.png?x-oss-process=image/resize,w_600,1_800, the cache corresponding to the URL before encoding will be refreshed;
    https://example.com/d/default_avatar.png?x-oss-process=image%2Fresize%2Cw_600%2C1_800, the cache corresponding to the URL after encoding will be refreshed.
    A maximum of the first 10,000 records can be displayed for cache purge history query. If more records are needed, it is recommended to narrow down the query scope or click Export Records at the bottom of the list. Currently, up to 500,000 records can be exported.

    Directions

    Scenario One: Clear cache by entering content

    If you have a small amount of content to clear and it is convenient to enter the content directly in the input box, you can follow these steps:
    1. Log in to the EdgeOne console, and in the left sidebar, click Purge Cache.
    2. On the cache purge page, select the corresponding site, choose the resource type to be cleared, enter the corresponding resource content, and click OK.
    
    3. Switch to the History Records tab to view the history records of the specified time range (within the last month) and purge type.

    Scenario Two: Clear cache by uploading a file for batch import

    If you have a large amount of content to clear or have already placed the content in a file, you can choose to upload the file:
    1. Log in to the EdgeOne console, and in the left sidebar, click Purge Cache.
    2. On the cache purge page, select the corresponding site, choose the resource type to be cleared, choose the "Upload file" method, and after uploading, click OK.
    
    3. Switch to the History Records tab to view the history records of the specified time range (within the last month) and purge type.

    Related References

    
    
    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