Cache Settings allow you to set how and when assets stored on a particular Scope in the CDN cache should be purged and replaced with fresh content from the Origin.
Caching content is one of the primary functions of a CDN. When you properly configure how and when new content is stored in the CDN cache, you enhance the delivery of your content to your customers on the web, and by optimizing how the CDN caches your content you reduce the stress of unneccesary requests placed on your Origin.
There are three policies available to you under the Cache Settings category.
CDN Caching lets you define how and when content stored specifically in the CDN cache expires and is replaced with new content from your Origin.
By default, when a new Site is created, the Cache Expiration Method will be set to Origin Controlled.
Cache Expiration Method
Indicates that Cache-Control headers on content from your Origin will determine expiration. The options bulleted below are selectable in your account from the dropdown.
- Origin Controlled - Cache-Control headers on content from your Origin will determine expiration.
- Relative to Ingest - time of ingest plus CDN TTL will determine expiration.
- Relative to Last Modified - CDN TTL will be used to check the Origin for modified assets, and if assets are modified the CDN will pull and cache them.
- Never Expire - content in cache will remain in cache eternally.
The expiration time used for content pulled from your origin server.
- If Cache Expiration Method is set to Origin Controlled and there is no Cache-Control header associated with the content, CDN TTL is the default caching max-age for content. A value of "0" in this case indicates the asset should be cached as long as possible.
- If Cache Expiration Method is set to Relative to Ingest or Relative to Last Modified, CDN TTL is the number of seconds since ingest, last access, or last modify to wait before expiring the asset.
Deliver These Origin Headers
Indicates that time of ingest plus CDN TTL will determine expiration.
Do Not Cache
Do not cache the asset. All headers will be straight proxied to and from the origin.
Stale Cache Extension
Stale Cache Extension allows you to tell the CDN how to treat stale content.
Sometimes your Origin may become unresponsive. God forbid it happens, but it might! In the event that it does, the CDN will retain stale content for as long as you wish, and will continue trying your Origin for a response. How long the CDN does these things is all up to you.
Stale Cache Retry Timer
In the event your Origin is unreachable, the CDN will try to establish a connection with it every 5 seconds. 5 seconds is the default but you can shorten or extend the retry timer if you need to.
Maximum Stale File TTL
If a lack in response from your Origin is everlasting, the CDN will keep stale content cached for as long as you'd like as specificed by this option and continue trying to reach your Origin every so many seconds as specified by the Stale Cache Retry Timer. There is no default set for Maximum Stale File TTL.
If your Origin fails to respond after the time set by the Maximum Stale File TTL, the CDN will stop retrying your Origin, it will stop delivering stale content, and the end-user will receive an error message.
The end-user's browser will cache content in a vartiety of ways. This policy and its options are not required but allows you to apply custom browser caching behaviors.
This is the expiration time used to control how long content can be cached by the end-user's browser, independently of how long that content is cached on the CDN.
Synchronize Browser And CDN TTLs
When you sync the Browser and CDN TTLs, the end-user's browser will match its own cache TTL to the amount of time remaining before the CDN TTL expires. Essentially, it's a prorated TTL based on the length of time remaining before the CDN TTL expires.