Priming the cache worldwide
When content changes, we use the Fastly API to purge the cache for that piece of content using cache tags/keys. This is useful. Is there a way to then immediately prime the cache in all POPs with the updated content?
-
Hi Nikhilesh Jasuja,
Unfortunately, there isn't a way to do that but our shielding feature can dramatically improve your cache hit ration if you haven't considered it yet.
See also:
https://support.fastly.com/hc/en-us/community/posts/360040169071-Fastly-and-Cache-Warming
-
Thanks Shohei.
This is actually very helpful. Here's my new config:
- The application (origin) sets Surrogate-Control: max-age=2592000, stale-while-revalidate=604800, stale-if-error=604800
- The origin also sets Surrogate-Key: key1 key2 key3
- When the page needs to be purged, the app makes a curl request: curl --silent -X POST -H 'Fastly-Soft-Purge:1' -H 'Fastly-Key:MY_KEY' https://api.fastly.com/service/ServiceID/purge/key1
However, this does not do the job. After the soft purge when I request the content, Fastly is not serving me stale content. It is making a request to the origin to get fresh content to serve.
If you'd like to try a URL to test it, you can use https://www.diffen.com/difference/Abiotic_vs_Biotic
Please sign in to leave a comment.
Comments
2 comments