What does it do?
Assets such as an image, CSS file, or JS file are saved with an expiration time, or lifetime, when they are saved on the CDN's cache. After the lifetime expires, the CDN fetches the asset again from the origin server the next time a user requests the asset, and the CDN sets a new lifetime based on the caching headers prescribed by your origin server or what's configured under the "Lifetime" dropdown.
Setting the lifetime for CDN assets can reduce the number of calls to your origin server and increase the time assets are served from the CDN's cache.
When and how should I use it?
The following options are available:
Origin controlled:the CDN honors your origin headers that instruct the CDN to cache an asset or not, and for how long.
Specify CDN TTL:the CDN caches assets for a custom amount of time ranging from 30 seconds to 60 days.
It's important to set an appropriate lifetime for different assets and use cases. Here are some examples:
- Logos, images, CSS files, and JS files are generally unchanging and can have a longer lifetime.
- Pages that update frequently should have a shorter lifetime.
You can customize the lifetime for specific pages and file extensions using EdgeRules:
Never expire:content remains cached on the CDN until manually purged.
Do not cache:content isn't cached but the CDN will pull content from the origin server on each request.