How to setup the CDN caching period for my images?

CDN caching accelerates the loading times of images as it allows to cache them as close as possible to your end-users. By using CDN caching, your ensure maximum performance of your website; this is also true for local website with an 80%+ audience geo-localised in one single country.

You can setup caching expiration period per Cloudimage token or per individual image URL. When both are set up, the individual expiration period has greater priority than the token's.

Individual Caching Interval

It is set up using the Cloudimage parameter ci_cache=X, where X is measured in seconds.

Example:

I would like to set up the Caching Interval for my image to be equal to 1 week.
1 week = 604800 sec, so I write:
www.token.cloudimage.io/v7/some_image_url?ci_cache=604800

Default Caching Interval per token:

When a new Cloudimage token is created, it comes by default with the following settings:

Screenshot 2024-02-15 at 11.33.46.png

max-age (Browser cache expiration interval) - it defines how long the image will remain in the browser's cache on the website visitor's local machine. By default this period is 30 days.

s-maxage (CDN cache expiration interval) - it defines how long the image will remain in the cache of the CDN servers. By default this period is 1 year.

Tips how and when to modify the Default Caching Interval settings:

  • The images kept in the CDN cache are part of your Image Cache (the Storage). For best service performance and optimal size of the Storage, the CDN caching interval should be in accordance with the average "life span" of the images in your website.
    Example:
    I have a website for selling of Real Estate properties. From the moment of publishing of the offer till the moment of its removal from the website, usually pass 2-4 months. There is no need to set up the CDN caching interval (s-maxage) to keep the images in my Storage for period of 1 year. A shorter period (like 6 months) would be more appropriate in this case.

  • The process of manual flushing of the CDN Cache is called Invalidation. Please note that most of the settings in the Cloudimage Admin panel requires Invalidation of the Image Cache after saving of any changes. Without this Invalidation, the CDN servers still keep the old version of the image files in their cache and the changes can't take action. In the Cloudimage documentation and the Admin panel exist many Reminders that prompt you to invalidate your old Image Cache when it is needed.
    Screenshot_2021-09-07_at_18.07.10.pngScreenshot_2021-09-07_at_18.05.38.png

In case of any doubts or questions about the set up of the Caching Interval, you can open a ticket to our Support team. Please include:

- your token;

- short description of your usecase (what is your website about, how often the images need to be refreshed, what is the average "life span" of an image in this website)

- short description of the problem (if the ticket is about reporting of an issue)

We will check your usecase and will provide an answer in a timely manner.

The official Cloudimage documentation for the Caching Interval can be found here.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.