All Products
Search
Document Center

CDN:PushObjectCache

最終更新日:Nov 29, 2024

Prefetches content from origin servers to points of presence (POPs). This reduces loads on origin servers because users can directly hit cache upon their first visits.

Operation description

  • Alibaba Cloud CDN supports POST requests in which parameters are sent as a form.
  • You can call the RefreshObjectCaches operation to refresh content and call the PushObjectCache operation to prefetch content.
  • By default, each Alibaba Cloud account can submit up to 1,000 URLs per day. If the daily peak bandwidth value of your workloads exceeds 200 Mbit/s, you can submit a ticket to increase your daily quota. Alibaba Cloud reviews your application and then increases the quota accordingly.
  • You can specify at most 100 URLs in each prefetch request.
  • For each Alibaba Cloud account, the prefetch queue can contain up to 50,000 URLs. Content is prefetched based on the time when the URLs are submitted. The URL that is submitted the earliest has the highest priority. If the number of URLs in the queue reaches 50,000, you cannot submit more URLs until the number drops below 50,000.
  • You can call this operation up to 50 times per second per account.
  • For more information about how to automate refresh or prefetch tasks, see Run scripts to refresh and prefetch content.

Precautions

  • After a prefetch task is submitted and completed, the POPs immediately start to retrieve resources from the origin server. Therefore, a large number of refresh tasks cause a large number of concurrent download tasks. This increases the number of requests that are redirected to the origin server. The back-to-origin routing process consumes more bandwidth resources and the origin server may be overwhelmed.
  • The time required for a prefetch task to complete is proportional to the size of the prefetched file. In actual practice, most prefetch tasks require 5 to 30 minutes to complete. A task with a smaller average file size requires less time.
  • To allow RAM users to perform this operation, you must first grant them the required permissions. For more information, see Authorize a RAM user to prefetch and refresh resources.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
cdn:PushObjectCachenone
*Domain
acs:cdn:*:{#accountId}:domain/{#DomainName}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ObjectPathstringYes

The URLs based on which content is prefetched. Format: accelerated domain name/files to be prefetched.

Note Separate URLs with line feeds (\n or \r\n). Each object path can be up to 1,024 characters in length.
example.com/image/1.png\nexample.org/image/2.png
AreastringNo

The acceleration region where content is to be prefetched. Valid values:

  • domestic**: Chinese mainland**
  • overseas**: regions outside the Chinese mainland**

If you do not set this parameter, content in the service location (specified by parameter Coverage) that you configured for the domain is prefetched. Content is prefetched based on the following rules:

  • If the acceleration region is set to Chinese Mainland Only, content in regions in the Chinese mainland is prefetched.
  • If the acceleration region is set to Global, content in all regions is prefetched.
  • If the acceleration region is set to Global (Excluding the Chinese Mainland), content in regions outside the Chinese mainland is prefetched.
domestic
L2PreloadbooleanNo

Specifies whether to prefetch content to L2 points of presence (POPs). Valid values:

  • true: prefetches content to L2 POPs.
  • false: prefetches content to regular POPs. Regular POPs can be L2 POPs or L3 POPs. Default value: false.
true
WithHeaderstringNo

The custom header for prefetch in the JSON format.

{ "Accept-Encoding": [ "gzip" ] }
QueryHashkeybooleanNo

This parameter specifies whether to enable the hash key query mode when you run a prefetch task. Valid values:

  • false: The default mode, in which the submitted URL is used as the hash key for the prefetch.
  • true: In this mode, the actual hash key used for the prefetch is queried based on the configuration of the domain name.
true

Response parameters

ParameterTypeDescriptionExample
object
PushTaskIdstring

The ID of the prefetch task. If multiple tasks are returned, the IDs are separated by commas (,). The task IDs are merged based on the following rules:

  • If the tasks are set for the same accelerated domain name, submitted within the same second, and prefetch content from URLs instead of directories, the tasks IDs are merged into the same task ID (RushTaskId).
  • If the number of tasks that are set for the same accelerated domain name, submitted within the same second, and prefetch content from URLs instead of directories exceeds 500, every 500 task IDs are merged into the same task ID (RushTaskId).
9524xxxx
RequestIdstring

The ID of the request.

16A96B9A-F203-4EC5-8E43-CB92E68F4CD8

Examples

Sample success responses

JSONformat

{
  "PushTaskId": "9524xxxx",
  "RequestId": "16A96B9A-F203-4EC5-8E43-CB92E68F4CD8"
}

Error codes

HTTP status codeError codeError messageDescription
400SingleRequest.OverLimitA maximum of 1000 URLs are supported for each request.-
400QuotaExceeded.PreloadYour preload attempts have exceeded the daily limit.The maximum number of URL prefetches on the current day is exceeded.
400InvalidObjectPath.MalformedThe specified ObjectPath is invalid.-
400InvalidExtensiveDomain.ValueNotSupportedThe specified ExtensiveDomain is not supported.-
400PreloadQueueFullThe warming queue is full,please try again later.-
400PreloadQueueFullPreload queue is full, please try again later.Preload queue is full, please try again later.
400QuotaPerMinuteExceeded.RefreshYou have exceeded the prescribed preload limits per minute.-
400InvalidObjectPath.ExceedsMaximumThe maximum number of urls is exceeded.The number of submitted URLs exceeds the maximum limit.
400InvalidCustomHeaderParse preload header failed.Custom header parsing error.
400InvalidCustomHeaderUnsupported Preload headers included.Invalid custom preheat header.
429TooManyRequestsSystem load fluctuates, please try again later.System load fluctuates, please try again later.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-11-03API Description Update. The Error code has changed. The request parameters of the API has changedView Change Details
2024-08-21The Error code has changedView Change Details
2023-07-25The Error code has changedView Change Details