All Products
Search
Document Center

Dynamic Content Delivery Network:What is caching?

Last Updated:Mar 19, 2024

When Dynamic Content Delivery Network (DCDN) accelerates the delivery of static resources to a user, DCDN retrieves the resources from the origin server and caches the resources on the point of presence (POP) that is nearest to the user. When the resource is requested again, the POP directly returns the cached resource to the user without redirecting the request to the origin server. This accelerates content delivery. If the resource that is requested by the user does not exist on the POP or has expired, the POP initiates an origin fetch request to retrieve the latest data from the origin server.

Caching features

DCDN supports the following caching features.

Feature

Description

Create a cache rule for resources

Time-to-live (TTL) is the amount of time that a resource is cached on Dynamic Content Delivery Network (DCDN) points of presence (POPs). When the TTL of a cached resource ends, the resource on the POPs expires. Requests that attempt to access expired resources are redirected to the origin server. The retrieved resources are returned to the clients and cached on the POPs. You can create a cache rule for static resources based on file directories or file name extensions.

Create a cache rule for HTTP status codes

When points of presence (POPs) retrieve resources from origin servers, the origin servers return HTTP status codes to the POPs. Dynamic Content Delivery Network (DCDN) allows you to create cache rules for HTTP status codes. When clients request the same resource, the POPs return the status code instead of redirecting requests to the origin server. This reduces loads on origin servers. After a cached HTTP status code expires, requests that trigger the code are redirected to the origin server.

Configure HTTP response headers

HTTP response headers are a component of the header section in response messages that are transmitted over HTTP. HTTP response headers deliver specific parameters to clients to manage caching. You can configure HTTP response headers and allow DCDN to return the configured response headers. This way, specific features, such as cross-origin resource sharing (CORS), can be implemented.

Create a custom error page

After you create a custom error page, if the requested content does not exist or an error occurs, points of presence (POPs) return the custom error page instead of the default error page. This can improve user experience by providing users with user-friendly and functional error messages.

Create a URI rewrite rule

If a resource on the origin server is relocated, the URL of the resource that is cached on Dynamic Content Delivery Network (DCDN) points of presence (POPs) is accordingly adjusted. If a user request carries an outdated URL, POPs rewrite the URL and redirect the request to the new URL. This reduces the number of requests that are sent to the origin server and enhances user access performance.

Create custom cache keys

You can create rules to generate cache keys based on different parts of HTTP requests, such as URIs, request parameters, HTTP request headers, and custom variables. You can also use this feature to convert URLs for the same resource into the same cache key. This improves the cache hit ratio, and reduces the number of requests that are redirected to the origin server, response time, and bandwidth usage.

Configure CORS

After you add your website to Dynamic Content Delivery Network (DCDN) for content delivery, you can configure custom HTTP response headers to access resources from different origin servers.

Note

For dynamic requests, you can ignore the request hit ratio or byte hit ratio due to the following reasons:

  • Data between the client and DCDN POPs is transmitted over HTTP/2, which supports header compression. Back-to-origin requests are sent over HTTP. The traffic of back-to-origin requests must be more than that of edge access requests.

  • By default, DCDN POPs add headers that mark DCDN information to back-to-origin requests. The headers also increase the size of back-to-origin requests.

In both cases, a small amount of byte hit data exists and can be ignored.