Purging your cache
Purging gives you the ability to remove cached content from the CDN edge nodes. Tinify CDN automatically caches all requested files for at least one month. There are scenarios where you want to remove the cached content, for example when you have refreshed certain files or have accidentally published a file that should not be public.
There are three methods for ensuring your users are getting the updated/new file.
- Purge everything
- Custom purge
- Ensuring file name uniqueness (best practice)
Please note that for methods 1 and 2 the process can take a few hours to propagate through the network.
Purge everything
This method clears all cached objects from the CDN caches. Keep in mind that this will result in a large increase in your website traffic because the content needs to be pulled from your website.
Instructions on how to purge everything
- Go to your Tinify CDN dashboard page at https://tinify.com/dashboard/cdn
- Click or tap the three dots menu next to your CDN endpoint.
- Click or tap Purge cache.
- Select Everything and click or tap Purge
- A confirmation window will appear. Please read carefully and click or tap Confirm to initiate the process of purging your complete CDN cache.
- Your purge request has been sent and all cached objects will be removed from the CDN caches.
Custom purge
With this method, you can delete a select number of files from Tinify CDN. You will have to specify the complete path to the file on Tinify CDN.
https://xxxxxxxx.tinifycdn.com/panda.png?resize.width=100&resize.height=50&resize.method=fitTo purge this thumbnail you should include the parameters in the same order as when the thumbnail is generated:
/panda.png?resize.width=100&resize.height=50&resize.method=fitPlease note that a maximum of 200 paths can be submitted for purging within 24 hours.
Instructions on how to purge certain content
- Go to your Tinify CDN dashboard page at https://tinify.com/dashboard/cdn
- Click or tap the three dots menu next to your CDN endpoint.
- Click or tap Purge cache.
- Select the option Custom.
- A text field will appear. Please enter the file paths separated by a comma (,) or a new line. In case you use query parameters (like resize options) you will need to include them in the file path.
- Your purge request has been sent and all cached objects will be removed from the CDN caches.
Best practice: File name uniqueness
A best practice for working with web assets is to make file names unique. This way when you reference your new file, it will be fresh in the CDN cache and it will also bypass the browser cache of your end-users. The file name can be prepended by a short checksum of the file, but it can also be just a number.
For example instead of using
/logo.png
rename it to:
/36c98e3.logo.png
Or
/logo-v2.png