Cache management
Container caching settings
CDN caching accelerates the loading times of images as it allows to host them as close as possible to your end users. By using CDN caching, your ensure maximum performance of your website.
You can define the max-age
and s-maxage
attributes in the Cache-Control HTTP Header of media assets delivered by Filerobot to control the caching behaviour.
When the cache interval expires, the media asset will be considered as stale and the CDN will request it again from the origin. Reduce the default values if you have rotating images but static image URLs without versioning.
In the interest of better performance, we recommend to use at least 7 days (604800 seconds) for max-age
and s-maxage
. This would keep your cache-hit ratio high and avoid too frequent re-downloads of the media asset from the Filerobot store by the CDN PoP.
attribute | description |
---|---|
max-age | The time in seconds that the image is allowed to be re-used. For instance, max-age=36000 indicates that an image remains in the browser cache for the next 36 000 seconds (10 hours). |
s-maxage | This directive applies only to the caching in CDN. To maximise performance, we recommend you set a high value here and invalidate images when needed. |
Default cache interval
You can access the caching settings by navigating to Accelerate settings / Caching.
Cache override
In case specific media assets are meant to change frequently and versioning of your URLs is not possible, it is possible to override the default cahcing interval using the ci_cache
parameter.
https://fdocs.filerobot.com/docs/paris.jpg?ci_cache=7200
This will override the max-age
and s-maxage
attributes for this asset only to 7200 seconds.
Invalidation / Flush
If a media asset needs to be refreshed in the cache and you do not want to wait until the cache interval expires, then you can trigger an invalidation on the Filerobot CDN to refresh the media asset. The Invalidation API is available for various types of invalidation.