Set the cache duration (TTL) for browsers

On this page

Files are cached on your Sirv CDN and in your users' browsers, for the fastest possible loading speed.

This article explains the default cache settings and how to change them.

Automatic cache purging

Sirv CDN automatically stays up to date. You don't need to manually purge the CDN after you upload new versions of files to Sirv. All cached versions of the old file are invalidated within a few seconds across Sirv's CDN, meaning the old file will never be served again.

There are two scenarios where the old file might still exist. It may have been cached in the users' web browser or it might still be cached on a CDN server - very rare but possible.

Manual cache purging

It is possible to manually clear a file from the Sirv CDN cache. This is very rarely needed because Sirv automatically clears the cache whenever you overwrite an image. However, in rare scenarios, a cached version of a file might not be cleared from a CDN cache, for example if the cache clearing request was lost or timed out.

If you think an old image is being served, test it by requesting the image from another browser or device. If you still see the old image, right-click the image in your Sirv account and choose "Purge from cache":

Purge file from cache

Browser cache duration

Browsers cache (save) files so help them load fast, rather than re-downloading the same files again.

Sirv sets an "expires header" of 7 days by default, meaning that file will live in the browser cache for the next 7 days. Known as the TTL (time to live), 7 days is a broadly suitable period for files that change relatively frequently. If your files change rarely, consider increasing the TTL as long as 1 year. If they change frequently, consider reducing it to 1 day or even less.

Choose from any of the following browser cache durations:

  • 1 hour
  • 3 hours
  • 12 hours
  • 1 day
  • 7 days
  • 30 days
  • 1 year

Change global cache duration

This global setting applies to all files in your Sirv account, specified in your Default profile. (It can be overridden with a profile, see below).

To change the default duration:

1. Go to your Default profile. Browsers cache images for the duration specified in thewhich is served with each file.

2. Click 'Delivery settings' in the top left.

3. Change the value then click Save:

CDN file purge button

Change cache duration per-profile

You can also set a different cache expiry time for certain files. Create a profile and in the profile choose a cache expiry time.

Apply the profile to whichever files you wish by appending its name in the URL, for example:

https://demo.sirv.com/example.jpg?profile=long-expiry

In that example above, the profile is named "long-expiry".

TTL for scripts and video streams

Files delivered from scripts.sirv.com and video.sirv.com have a TTL of 7 days. This is a global default and cannot be altered.

Get expert help

If you have questions about file caching, please send a message to the Sirv support team.

Was this article helpful?

Array

Get help from a Sirv expert

help ukraine help ukraine Powered by Ukrainian determination and British ingenuity

How can you support Ukraine