已更新 json 文件未显示在 public link 中

updated json file not showing in public link

我在更新位于存储桶中的 json 文件时遇到了一些问题,该文件将被 html 页面调用。我将每 5 分钟从命令行更新我的 json 文件,这是可以做到的。然而,即使 json 文件本身已更新并设置为 public,public link 仍然显示旧内容而不是新内容。

如果我点击json文件,我可以看到内容已经改变了,但是如果我点击public link,内容仍然没有更新。

有人知道 Google 云存储加载缓冲区需要多少时间才能在 public link 中显示新内容吗?

或者有什么方法可以更新 json 文件并让 public link 立即更新?

谢谢!

默认情况下,公开可见的 object 匿名访问的 cache-control header 设置为 1 小时。您可以在上传新 object 时通过将 cacheControl 元数据显式设置为其他内容来覆盖它。

如果您使用 gsutil 上传 object,您可以这样做:

gsutil -h "Cache-Control:no-cache, max-age=0" \
    cp -a public-read myfile.json gs://mybucket