All Products
Search
Document Center

ApsaraVideo VOD:Purge and prefetch

Last Updated:Feb 10, 2026

When your origin server content is updated or you need to remove non-compliant resources, you must purge the cache on Content Delivery Network (CDN) points of presence (POPs). This ensures users access the latest content. Before an event or new content goes live, prefetching resources to CDN POPs can significantly improve first-visit speed for users and reduce the load on your origin server. This topic describes how to use the cache purge and resource prefetch features of ApsaraVideo VOD.

Function Introduction

Resource purge

A purge operation sends a cache invalidation command to CDN POPs, rather than directly deleting files. When a POP receives the command, it marks the matching cached resources as invalid or expired. The next time a user requests the resource, the POP detects the invalid cache, retrieves the latest version from the origin server, and serves it to the user while caching the new version.

Scenarios

  1. Update and release content: After you update resources on your origin server, you can purge their URLs or directories. This ensures that users receive the latest versions instead of stale content.

  2. Remove non-compliant content: If you delete non-compliant content from your origin server, it might still be accessible from the CDN cache. You can use the URL purge feature to clear the cache and ensure that the content is completely removed.

Resource prefetch

Prefetching prompts CDN POPs to retrieve resources from your origin server based on a provided URL list and cache them. This process differs from the origin server actively pushing content. Prefetching improves the loading speed of new resources or promotional pages for first-time visitors and reduces back-to-origin traffic during high-traffic events, which protects your origin server.

Scenarios

  1. Onboard Alibaba Cloud CDN: When you first start using Alibaba Cloud CDN, you can prefetch your popular static resources to the POPs. This improves access speeds and enhances the user experience.

  2. Support promotional campaigns: Before you launch a major promotional campaign, you can prefetch all static resources for the campaign pages to the CDN POPs. When the campaign begins, the POPs directly serve all user requests for these resources, which ensures fast page loads.

  3. Publish installation packages or large files: Before you release a new software version or update package, you can prefetch the resources to the CDN POPs. After the official launch, the POPs directly handle user download requests, which accelerates download speeds and reduces the load on your origin server.

Prerequisites

  • Timing: Purge and prefetch tasks generate back-to-origin traffic. You can run large-scale purge or prefetch tasks during off-peak hours.

  • URL format: If a URL that you submit contains non-ASCII characters, such as Chinese characters or spaces, you must first perform percent-encoding in UTF-8.

  • Shared cache: If a domain name is configured with a shared cache, submitting a purge task using the primary domain name or any associated domain name invalidates the cache for all associated domain names.

Procedure

Purge resources

  1. Log on to the ApsaraVideo VOD console.

  2. In the left-side navigation pane, choose Configuration Management > CDN Configuration > Refresh and Prefetch.

  3. On the Purge Cache tab, set Operation Type to Purge.

  4. Select a refresh method based on your requirements and submit the task.

    Refresh Method

    Description

    URL

    Purpose: Purge the cache for one or more specific files.

    Operation: In the URL text box, enter the full URLs, including http:// or https://. Enter one URL per line. Example: https://www.example.com/static/image.jpg.

    Folder

    Purpose: Purge the cache for all files and subdirectories in a CDN directory.

    Operation: Enter the complete directory URL, and make sure it ends with /. For example: https://www.example.com/static/.

    Note: This is an update-based purge. To force purge the entire directory, use Refresh Cache and set Force=true.

  5. Click Submit. The system starts to run the purge task.

    Note
    • You cannot abort a purge task after it is submitted.

    • A purge task typically takes 5 to 6 minutes to take effect across the entire network. If the time-to-live (TTL) of the cache is shorter than this duration, you do not need to manually purge the cache.

Prefetch resources

  1. Log on to the ApsaraVideo VOD console.

  2. In the left-side navigation pane, choose Configuration Management > CDN Configuration > Refresh and Prefetch.

  3. On the Purge Cache tab, set Operation Type to Prefetch.

  4. In the URL text box, enter the full URLs of the files that you want to prefetch. Enter one URL per line. You cannot prefetch directories. Example: https://www.example.com/install/package.zip.

  5. Click Submit. The system starts to run the prefetch task.

    Note
    • You cannot abort a prefetch task after it is submitted.

    • The time required to complete a prefetch task depends on the file size, number of files, and origin server performance. It typically takes 5 to 30 minutes.

Validation Results

  • Manual query

    On the Operation Record tab, you can view the details and progress of purge or prefetch tasks. A progress of 100% indicates that the task is complete. If you purge or prefetch many resources, the task may take longer to complete. Wait for the task to finish.

  • API query

    You can call the GetMediaRefreshJobs operation to check the status of a purge or prefetch task.

  • Command line validation

    Run the curl -I <resource_URL> command. The output is similar to the following:

    image

    If the X-Cache header exists:

    • If X-Cache is HIT, the request hit the cache and the prefetch was successful.

    • If X-Cache is MISS, the request missed the cache. This indicates that the prefetch task is incomplete or has failed. Prefetch the resource again.

    If the X-Cache header does not exist:

    If the X-Cache header is not present, the resource has not been added to CDN. Follow the instructions in Add a domain name to configure the domain name for the URL, and then prefetch the resource.

Limits

Operation type

Method

Quota limit

refresh

URL purge

Each account can submit up to 2,000 entries per day, with a maximum of 1,000 entries per request.

directory refresh

Each account is limited to 100 requests per day and 100 items per request.

Prefetch

URL prefetch

You can submit up to 500 items per account per day and up to 100 items per request.

Billing

The purge and prefetch features are free of charge.

However, both operations trigger CDN edge POPs to pull resources from the origin server. This generates costs for back-to-origin traffic and origin requests. The billing standards depend on the type of origin server you use:

  • If the origin server is an ApsaraVideo VOD bucket, you are charged for outbound traffic from storage.

  • If the origin server is Alibaba Cloud Object Storage Service (OSS), you are charged for traffic and requests based on the OSS billing rules.

Important

Large-scale purge or prefetch operations, especially within a short period, may increase back-to-origin costs. Evaluate the potential cost impact before you perform these operations.

Related API operations

FAQ