Updated on 2024-04-25 GMT+08:00

Cache Purge

Background

After resources on the origin server are updated, if the old resources cached on CDN PoPs do not expire, CDN still returns the old resources to users. You can use cache purge to forcibly expire resources cached on CDN PoPs. When a user accesses a resource, CDN pulls the latest resource from the origin server, returns it to the user, and caches it on CDN PoPs.

Typical Scenarios

New content release: After new content overwrites old content with the same name on origin servers, to enable all users to access the latest content, you can submit requests to refresh corresponding URLs or directories of the content, forcing the cached content on the PoPs to expire.

Non-compliant content clearing: When non-compliant content is detected and deleted from origin servers, the cached content on PoPs can still be accessed. You can refresh URLs to delete the cached content.

Precautions

  • Cache purge can be performed only for unbanned domain names in Enabled or Configuring state. For more information about the domain status, see Viewing Basic Domain Information.
  • If a URL is rewritten, you must use the actual resource path of the new URL for cache purge.
  • Some resources may be cached in browsers. Refresh the browser cache after the PoP cache is refreshed.
  • You can also create a cache purge task for a domain name by calling an API. For details, see API Overview.
  • It takes about 5 minutes for a cache purge task to take effect.
  • By default, cache of TS/MP4 files under M3U8/MPD index files is not refreshed.

Procedure

  1. Log in to Huawei Cloud console. Choose Service List > Content Delivery & Edge Computing > Content Delivery Network.

    The CDN console is displayed.

  2. In the navigation pane, choose Prefetch & Purge.
  3. Click the Purge tab, select the content type, and enter the URLs or directories to be refreshed or drag a TXT file to the text box.
    Figure 1 Cache purge
    Table 1 Parameter description

    Type

    Description

    URL

    • CDN refreshes a specific file.

    The format of a URL in the text box or in the TXT file must meet the following requirements:

    • Each account can refresh a maximum of 2,000 URLs per day and a maximum of 1,000 URLs per task.
    • The http:// or https:// part of the URL must be included.
    • Enter one URL per row.

      Examples:

      http://www.example.com/file01.html

      http://www.example.com/file02.html

      https://example.huawei.com/download/app/abc.apk

      NOTE:
      • Submit complete file URLs. If you submit a directory, URL refreshing does not take effect.

    Directory

    Refreshing modes:

    • Refresh updated resources: Refresh resources that have been updated in a directory (including subdirectories).
    • Refresh all resources: Refresh all resources in a directory, including resources in subdirectories.

    Configuration rules:

    • Each account can refresh a maximum of 100 directories per day at a time.
    • A URL must contain http or https and end with a slash (/).
    • Enter one URL per row.

    Examples:

    http://www.example01.com/folder01/

    http://www.example01.com/folder02/

    NOTE:
    • URLs in the text box or in the TXT file have the same format requirements.
    • If you select Refresh all resources when refreshing the root directory, the cache of all resources will expire. As a result, CDN pulls content for all requests from the origin server. If the access traffic is too heavy, the origin server may break down.
    • If you select Refresh all resources when refreshing a directory, all resources in the directory, including subdirectories will be refreshed. Only one directory is counted against the directory refreshing quota.

    URL Encode

    If enabled, Chinese characters in URLs are automatically transcoded and cache is purged only for transcoded URLs.

  4. Click Submit.

    After a purge task is submitted, you can view the status of the task on the Task Progress tab.