Cloudflare Cache Settings

After seeing some really bad advice, I thought I would quickly share the correct settings for Cloudflare cache settings.

 

There are two settings, browser cache and edge cache.

Browser Cache

This refers to the time that the visitor’s browser will store your website on your computer and reload that as required. So if you set that to 1 hour, within that hour your website will load from the browser cache, which is the fastest way of loading a site.

So why not set the browser cache for longer ? If you do that, your website from the perspective of the visitor will not update, and your new posts etc will not show.

Edge Cache

This refers to the amount if time your site stays on the Cloudflare servers. So if a short time is set, the cache will expire on Cloudflare’s servers, and when a visitor requests a page, the Cloudflare servers will then have to get one, and then give it to the visitor, this is slow. Again, if you set this for a really long time, say a month, then Cloudflare will keep your cache on file for a long time, meaning you get a speedy site, but it will be a month old. If you set it for a short time,  the site will need to have frequent visitors to ensure the cache is primed and stored to use.

 

The Settings

There isn’t some magic settings that are best for all. You need to know your traffic, if you have a high traffic, frequently updating site, you need to set both caches for a shorter time period. If you have fewer visitors and less frequently updated site, you should set it to longer values. 

I personally am currently using 2 days for browser cache and 1 month for edge cache. 

Ahmed Hilmi

Ahmed Hilmi

Ahmed is a contributor for Medina minds. He has also written the book Shield of the Believer

Leave a Reply

Your email address will not be published. Required fields are marked *