Repeat Visitors When Cache Everything Enabled

#1

Say a URL requires only two requests when loaded, and cache everything (with 1 year expiry for browser data) is enabled.

If I visit the URL 30 times, will 60 requests be recorded or just 1?

Does the stat counter record all requests regardless of whether they’re repeat and served through CF cache?

Thank you, thank you, thank you…

#2

With caching things rarely are black and white, so take all that with a grain of salt.

In theory you will have exactly two requests for the two resources in this scenario. All following requests should go first to the browser cache and subsequently to Cloudflare’s cache. Here’s now where we discover the salt mine :wink:

First, as long as the browser caches it (for mentioned year) subsequent requestd should be local-only however there is no guarantee for that and the user can always force a refresh.

This leads us to the second part, Cloudflare’s cache. Once the browser sends a request it will hit Cloudflare and Cloudflare will serve the file from it cache, if it is still there. You didnt specify how long you set the caching duration on Cloudflare, but even if you set it to its maximum of a month, you wont have a guarantee it really will be cached for that long as Cloudflare does reserve the right to purge files, especially those which are accessed less frequently.

Of course this latter description only applies for requests going through the same Cloudflare datacentre. All locations/datacentres cache your resources individually.

The counter on Cloudflare? Yes that will also count requests which were served from Cloudflare’s cache, not however requests which the browser still had cached.

2 Likes
#3

Set to expire after a month.

Thanks for the answer. So basically, it’s complicated is what it is.

#4

In that case Cloudflare will keep the data for a maximum of up to a month but might remove it earlier, particularly if it is not frequently accessed.

Yes, caching is always a bit complicated. Caching and string parsing - whom am I kidding, all that IT stuff :smile: