All Collections
CDN and caching
How to purge (invalidate) assets from TwicPics CDN cache
How to purge (invalidate) assets from TwicPics CDN cache
Benjamin Arne avatar
Written by Benjamin Arne
Updated over a week ago

Common reasons for purging an asset are:

  1. Content Update: When your assets are updated, the old version cached on the CDN might still be served to users. Purging the assets ensures that users receive the most recent content.

  2. Content Removal: When certain content or assets are no longer needed or are intended to be removed permanently from the website, purging them from the CDN ensures they won't be accessible to users anymore.



How do I purge my assets delivered by TwicPics?

Best Practice method (Recommended for content update)

The best practice method is a transparent method that eliminates the need for human intervention. Assets and their derivates will be purged instantly from both the CDN and the end-user browser caches.

Whenever you are updating a visual asset, the best practice method is to give an asset a new URL by renaming the asset. By doing so, you avoid having to handle cache invalidations altogether.

If it is not possible or desirable to change the URL of an asset, you can consider adding a query string of versioning instead.

Example: https://domain.com/paths/image1.jpeg?v=2

CDN Purging request methods (recommended for content removal)

CDN purging request methods consist of sending an invalidation request instructing the CDN to remove cached copies of an asset and its derivates from CDN caches. CDN purging request methods are asynchronous and do not purge the end-user's browser caches.

The asset cache purge request allows for selective purging, meaning you can only clear out old version of certain assets and keep other cached assets unchanged. The asset cache purge requests can be made from the back-office or via an API.

The path purge request is similar as wildcard purge (bulk) and allows for purging all assets delivered through a specific path, at once. The path purge requests can be made only from the back-office.

⚠️ The path purge request has a significant negative impact on your site's web performance, so it should only be considered in exceptional cases.


Conclusion

Cached content on CDNs is important for improving website speed and performance, however outdated content can create inconsistencies. Purging assets from the CDN is a useful technique for ensuring users receive the most recent content.

If you need to update your visuals, please use the best practice method. It's the most efficient way to avoid extra work for your teams.

Our CDN Purging request methods remain at your disposal to remove assets from the cache or to help you when the best-practice method is not applicable.

Did this answer your question?