设置 Google Storage Bucket 的默认缓存控制 [英] Set Google Storage Bucket's default cache control

查看:24
本文介绍了设置 Google Storage Bucket 的默认缓存控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以设置Bucket的默认缓存控制(每次创建新对象时都尝试覆盖bucket级别的public, max-age=3600)

Is there any way to set Bucket's default cache control (trying to override the public, max-age=3600 in bucket level every time creating a new object)

类似于defacl,但设置了缓存控制

Similar to defacl but set the cache control

推荐答案

如果有人还在寻找答案,则需要在添加 blob 时设置元数据.对于那些想要更新存储桶中所有现有对象的元数据的人,您可以使用 gsutil 中的 setmeta - https://cloud.google.com/storage/docs/gsutil/commands/setmeta

If someone is still looking for an answer, one needs to set the metadata while adding the blob. For those who want to update the metadata for all existing objects in the bucket, you can use setmeta from gsutil - https://cloud.google.com/storage/docs/gsutil/commands/setmeta

您只需要执行以下操作:

You just need to do the following :

gsutil setmeta -r -h "Cache-control:public, max-age=12345" gs://bucket_name

这篇关于设置 Google Storage Bucket 的默认缓存控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆