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

查看:135
本文介绍了设置Google Storage 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-

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天全站免登陆