When Alibaba Cloud CDN accelerates the delivery of static resources to a user, Alibaba Cloud CDN retrieves the resources from the origin server and caches them on the edge node that is nearest to the user. When the resources are requested again, the edge node directly returns the resources to the user. This accelerates content delivery.

Default TTL value

If you have not created a cache expiration rule on your origin server or in the Alibaba Cloud CDN console, the default cache expiration rule applies. The default time-to-live (TTL) value for cached resources is 10 seconds and the maximum is 3,600 seconds. You can adjust the TTL value in the Alibaba Cloud CDN console. For more information, see Set a TTL value for cached resources.
Note The amount of back-to-origin data transfer and fees vary based on the TTL value. We recommend that you set a proper TTL value. A small TTL value may cause edge nodes to frequently redirect requests to the origin server and increase the amount of data transfer on the origin server.
  • The default TTL value is calculated based on the following formula: t = (curtime - last_modified) × 0.1.
  • Valid TTL values are 10 to 3600.
Parameters and descriptions:
  • t: the default TTL value, in seconds.
  • curtime: the current time.
  • last_modified: the last time when the resources on the origin server were updated.
Examples:
  • If the last_modified value of an object is 20140801 00:00:00 and the current time is 20140801 00:01:00, t = (curtime - last_modified) × 0.1 = 6 seconds. Based on the rules, the TTL value is 10 seconds because the minimum value is 10 seconds.
  • If the last_modified value of an object is 20140801 00:00:00 and the current time is 20140802 00:00:00, t = (curtime - last_modified) × 0.1 = 8,640 seconds. Based on the rules, the TTL value is 3,600 seconds because the maximum value is 3,600 seconds.
  • If the last_modified value of an object is 20140801 00:00:00 and the current time is 20140801 00:10:00, t = (curtime - last_modified) × 0.1 = 60 seconds. Based on the rules, the TTL value is 60 seconds.

Default cache expiration rule

  • If the response from the origin server does not contain the last-modified header but contains the ETag header, the retrieved object is considered a static resource. The default TTL value for this object is set to 10 seconds.
  • If the response from the origin server does not contain the last-modified or ETag header, the retrieved object is considered a dynamic resource. The default TTL value for this object is set to 0 seconds. The object must be retrieved from the origin server each time it is requested.
Note ETag indicates the resource identifier.

Related features

The following table describes the operations that you can perform on a domain name by using the caching feature.
Feature Description
Set a TTL value for cached resources Allows you to configure cache expiration rules for static resources in a specified directory or with specified file extensions. In each cache expiration rule, you can set a TTL value for the cached static resources and a priority for the rule. Edge nodes cache and expire static resources based on the cache expiration rules.
Create a cache expiration rule for HTTP status codes Allows you to set a TTL value for HTTP status codes that are returned to requests for resources in a specified directory or with specified file extensions.
Create a custom HTTP response header Allows you to customize HTTP response headers that control the expiration time of resources.
Create a custom error page Allows you to specify the complete URL of an error page for a specific HTTP status code.
Create a URI rewrite rule Allows you to rewrite URIs in requests and performs 302 redirects to redirect the requests to the destination URIs.
Custom cache keys Allows you to set a cache key for a type of request that is destined for the same resource file. This can help you save the cache space and reduce the number of requests redirected to the origin server.
Configure CORS Allows you to implement cross-origin resource sharing (CORS) by using custom HTTP response headers.

Best practices

For more information about how to configure Alibaba Cloud CDN by using WordPress, see Accelerate content delivery for infographic and video websites.