Cache Lifetime on the CDN Servers
Cached data is updated according to the cache settings. By default, a cache’s lifetime is 24 hours. This means that every 24 hours, the CDN communicates with the origin and checks to see if any cached files have been updated or changed. If they have, then the CDN downloads the latest version from the primary server.
Files that are not requested for an extended period of time are automatically deleted from the caching server. If a new request comes in, then the file is once again downloaded from the primary server.
The cache lifetime can be changed in the Cache Settings block under the Cache tab. Enter the maximum cache lifetime on the CDN servers and the browser cache lifetime.
Please note that regardless of the cache settings, if the file has not been requested for more than 36 hours, it is deleted from the CDN server cache.
Cache Lifetime in the Browser
The browser caching time is set by the source settings by default. If there are no such settings on the source, then the content will not be cached in the browser.
This option allows you to cache a file with different Cookies as a single object, otherwise the CDN caches the same file with different cookies from the HTTP header of the Set-Cookie request as different files. As a result, each new client request is proxied to the source, and not delivered from the cache.
Ignore Request Parameters
This option allows you to cache files with different query parameters as objects with the same key, regardless of the parameter value. The query parameter is a unique query string (the parameter after the question mark) in the URL.
This option allows to return the latest cached content if the content source isn’t available with the errors:
- error (network problems)
- updating (cache update)
The source availability will be checked with each user request. If the source has recovered, the CDN will cache the latest version of the file. If the source has not recovered, the CDN servers will deliver the content until the cache expires.
Speed up Caching of Large Files
This option is used to speed up caching of large files. Files larger than 10 MB will be stored in cache in 10 MB parts, for example, a 56 MB file will be divided into 6 parts: 5 of which are 10 MB each and the last is the remaining volume.
Purging the Cache
Clearing the cache may be required, for example, in case of updating the content on the source or if the data in the CDN is not displayed correctly.
Selective Cache Flushing
To selectively clear the cache:
Enter the relative path to the file or path template. Note: always indicate * or / at the beginning of the path. * replaces any number of characters.
Indicate each path as a separate line, for example:
Click Purge cache.
How to clear the cache of a single file cdn.site/static/image.jpg?
Enter the path to the file without a domain name: /static/image.jpg. Click Purge cache. All files will be deleted at cdn.site/static/image.jpg, including files that have query parameters .jpg?VERSION. If query parameters are used, enter the path with query parameters: /static/image.jpg?VERSION.
How to clear the cache for a group of files located in cdn.site/static?
Enter path mask without domain name and operator *: /static/. Click Purge cache.
How to clear the cache of a group of files with the extension .jpg?
Enter the * operator and file extension: *.jpg. Click Purge cache.
All files with the jpg extension, including files having the request parameters .jpg?VERSION, will be deleted.
How to clear the cache of a group of files containing the path / static /?
Enter the path mask without the domain name and the operator * twice: /static/. Click Purge cache.
How to clear the cache of a group of files containing in the path / static / with the extension .jpg?
Enter the path mask. Use the operator * : /static/.jpg. Click Purge cache.
Restrictions on cleaning:
- no more than 1 request per minute;
- no more than 50 path patterns in the request;
- cleaning time depends on the number of files.
Full Purge the Cache
To fully purge the cache:
- Select Purge all.
- Click Purge all cache.
- Confirm the operation. The amount of time it takes to purge the cache depends on the number of objects it has stored.
To prefetch the cache:
- Enter the relative path to the file. Always indicate / at the beginning of the path. Indicate each path as a separate line, for example: ‘/path/file1.jpg’.
- Click Prefetch Cache.