Google cloud storage: How can I reset edge cache?

后端 未结 1 1909
后悔当初
后悔当初 2021-01-01 13:21

I updated an image (from PHP) but still the old version of the image is downloaded.

If I download the image on the GCS console, I can download the new version of the

相关标签:
1条回答
  • 2021-01-01 13:58

    By default, if an object is publicly accessible to all anonymous users and you do not otherwise specify a cacheControl setting, GCS will serve a Cache-Control header of 3600 seconds, or 1 hour. If you're getting stale object data and haven't been messing with cache control settings, I assume you're serving publicly accessible objects. I'm not sure if Google itself is caching your object data or if there's some other cache between you and Google, though.

    In the future, you can fix this by explicitly setting a shorter Cache-Control header, which can be controlled on a per-object basis with the cacheControl setting.

    Right now, you can probably get around this by tacking on some made up extra URL query parameter, like ?ignoreCache=1

    More: https://cloud.google.com/storage/docs/xml-api/reference-headers#cachecontrol

    0 讨论(0)
提交回复
热议问题