Changing the cache duration (TTL) for browsers

On this page

When you upload a new version of an image (or other file) to your Sirv account, the old version is permanently overwritten. Cached versions of that image are invalidated instantly on Sirv direct and within 3 seconds across all of Sirv CDN. This means the old image will never be served again.

Old images may still be seen by repeat visitors, if their browser has cached the images. Browser caching helps pages load fast, by serving locally saved images instead of re-requesting images from the server. The downside is that a repeat visitor could see old images, until the cached images expire from their browser.

Browsers cache images for the duration specified in the "expires header" which is served with each file. By default, Sirv sets an expires header of 7 days, so that's the longest possible time a previous visitor might see an outdated image for. It's known as the TTL (time to live) and 7 days is a broadly suitable period of time. If your files change rarely, you can consider increasing the TTL. If they change frequently, you can consider reducing it.

Cache duration can be set for your whole account or to specific profiles.

Change global cache duration

The period of time for which browsers cache your files can be set to 1 hour, 3 hours, 12 hours, 1 day, 7 days, 30 days or 1 year. This is a global setting, for all files in your Sirv account, specified in your Default profile.

To change the duration:

1. Go to your Default profile.

2. Click Edit in the top right.

3. Change the value then click Save:

CDN file purge button

Change cache duration per-profile

To set a different cache expiry time for specific files, apply a profile to those files. Each profile can have its own cache expiry time.

A profile can be applied by appending its name in the URL, for example:

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

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

Was this article helpful?

Get help from a Sirv expert