Last update：2023-10-25 16:20:54
Caching static files on the CDN edge PoPs is an important means of speeding up the website and streaming media. The website or streaming media administrators normally update content (such as content adding, deletion and modification) in the day-to-day operation. In order to help the website and video platform to better manage their cached content such as videos, images and software, CDNetworks provides the file purging feature to ensure that visitors have the access to the latest content even when stipulated caching has not expired. File purging are inclusive of URL purging, directory purging, cache-tag purging and RegEx purging.
If customers are highly time-sensitive or their day-to-day file updates amount is large, it is recommended for them to enable the purging service. Customers could select the most suitable purging mode based on their business types.
After the file purging task is successfully submitted in the CDNetworks file purging system, the corresponding command is broadcast to all the edge PoPs used by the accelerated domain. The edge PoPs check the target file submitted by the customer, and mark the corresponding file as expired or directly delete the file.
URL/directory/cache tag purging can be divided into two modes: expire (first determine if the URL under the directory has expired) and delete (directly delete URL under the directory).
After the file is marked as expired, CDN edge PoPs will check by file name to see if the file attribute values of Last-Modified or Etag on the website origin server and on the CDN edge PoP are matched when receiving requests from end users. Take Last-Modified checking as an example. If the Last-Modified time of the file on the CDN edge PoP is earlier than that of the file on the origin, CDN server will determine that the cached file has expired. And CDN PoPs will download the newer file from origin server to replace the old version at the edge.
Similarly, if the Etag value of the file on CDN edge PoP is different from that on the origin server, then the server determines that the cached has expired. If the target file does not have the Last-modified or Etag attribute value, the server will retrieve a new file from the origin instead of doing the comparison. If the target file has both Last-Modified and Etag attribute values, the file is treated as expired when one of the attribute values is determined expired.
After CDN PoP receives the file purging command, it will not compare the cached file with the file on the origin, but directly delete it. As for the directory deletion, the system does not check with origin to see if the file has expired, but delete all the files under the directory. After the files are deleted, CDN PoPs will download the new files from origin.
CDNetworks file purging system currently provides 2 operating channels: purge via Webpage and purge via API Interface.