Technology Encyclopedia Home >What is the mechanism for CDN cache refresh?

What is the mechanism for CDN cache refresh?

CDN (Content Delivery Network) cache refresh is the process of updating or invalidating cached content on CDN edge servers to ensure users receive the latest version of a file or webpage. This is crucial when content changes frequently, such as with dynamic websites, news updates, or software downloads.

Mechanism of CDN Cache Refresh

  1. Cache Invalidation

    • When a file is updated on the origin server, the CDN must remove the outdated cached copy.
    • This can be triggered manually (via API or console) or automatically (via rules or time-based expiration).
  2. Time-to-Live (TTL) Expiration

    • Each cached file has a predefined TTL (e.g., 1 hour, 1 day). Once expired, the CDN fetches the fresh version from the origin server.
  3. Manual Purge

    • Users can manually purge specific files or entire directories from the CDN cache, forcing the CDN to fetch new content from the origin.
  4. Versioning (File Naming)

    • Changing the file name (e.g., script_v2.js instead of script.js) ensures the CDN treats it as a new file, bypassing the old cached version.

Example

A news website updates an article titled breaking-news.html. To ensure users see the latest version:

  • The website admin manually purges breaking-news.html from the CDN cache.
  • Alternatively, the CDN is configured to check the origin server every 5 minutes (short TTL) for updates.

Tencent Cloud CDN Cache Refresh

Tencent Cloud CDN provides efficient cache refresh mechanisms:

  • URL Purge: Manually invalidate specific URLs or directories.
  • Directory Purge: Refresh entire folders at once.
  • Preloading: Pre-cache content before it’s requested to reduce latency.
  • TTL Settings: Customize cache expiration for different file types.

Tencent Cloud CDN ensures fast and reliable content delivery with flexible cache management options.