Hi all,
I am using Cloud CDN to serve static content from a backend bucket.
Have been looking in the documentation and was unable to find any information regarding this topic, so I came here to ask.
Is it possible to automatically invalidate Cloud CDN's cache for all asset that has been updated? If not, what alternatives do I have instead of manually triggering the cache invalidation for that object's url.
Best regards
Solved! Go to Solution.
So good practice would typically be to set lifetimes on content that is appropriate, so that when you update, the content naturally expires and is re-cached. So in the first instance you could wind down the TTLs.
Saying that, I realise this may not always be appropriate. Where is the content stored? If you are uploading objects to Cloud Storage, you could trigger a Cloud Workflow which as a connector to directly invalidate the cache:
https://cloud.google.com/eventarc/docs/workflows/quickstart-storage
https://cloud.google.com/workflows/docs/reference/googleapis/compute/v1/urlMaps/invalidateCache
Or you could write a small Cloud Function that invalidates the object on change:
https://cloud.google.com/functions/docs/calling/storage
By calling the REST API directly:
https://cloud.google.com/compute/docs/reference/rest/v1/urlMaps/invalidateCache
Just some ideas.
Alex
So good practice would typically be to set lifetimes on content that is appropriate, so that when you update, the content naturally expires and is re-cached. So in the first instance you could wind down the TTLs.
Saying that, I realise this may not always be appropriate. Where is the content stored? If you are uploading objects to Cloud Storage, you could trigger a Cloud Workflow which as a connector to directly invalidate the cache:
https://cloud.google.com/eventarc/docs/workflows/quickstart-storage
https://cloud.google.com/workflows/docs/reference/googleapis/compute/v1/urlMaps/invalidateCache
Or you could write a small Cloud Function that invalidates the object on change:
https://cloud.google.com/functions/docs/calling/storage
By calling the REST API directly:
https://cloud.google.com/compute/docs/reference/rest/v1/urlMaps/invalidateCache
Just some ideas.
Alex