What does it do?
When an asset (image, CSS file, JS file, etc.) is saved on the CDN cache it's saved with an expiration time, or lifetime. After it expires the CDN fetches it again from the origin server (when the asset is requested) and sets a new lifetime based on the caching headers prescribed by your origin server or what's configured under "Lifetime" in the dropdown.
When and how should I use it?
Setting the lifetime for CDN assets can reduce the number of calls to your server and increase the time assets are served from the CDN cache.
The following options are available:
Origin Controlledthe CDN honors your origin headers that instruct the CDN to cache an asset or not, and for how long.
Specify CDN TTLyou can instruct the CDN to cache assets for a custom time (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 Expirecontent remains cached on the CDN until manually purged.
Do Not Cachethe content won't be cached but the CDN will pull content from the origin server on each request.