how long is the maximum cache livetime?
I have a landing page builder saas with Astro in SSR mode and cloudflare worker.
a few of pages type, like index page of my client business and several others, are largely static with minimum change.
how can I set cloudflare to cache it for eternity unless I purge the cache by url via cloudflare api?
4 Replies
Cloudflare's cache will keep frequently requested assets cached for at most the specified cache lifetime. If an asset isn't requested often enough, it might be evicted sooner. I don't know of any way to force retain anything in cache.
I believe that it doesn’t work with the cache api in pages functions
Yeah caching isn’t as simple as put/match 😅
And that 30 days is refreshed on hits so if you have ttl 1 year and it's hit at least every 30 days it will live out the whole year in cache or cache reserve
Thanks @PurpleBlob @FloppyDisk 💾 @Erisa | Support Engineer 😄
So I just need to set the ttl for a year, activate the cache reserve + r2 and purge cache via api everytime my customer update their landing page
You don't need to enable R2 but yeah