Shrine是否支持在S3存储桶中的文件夹之间复制/移动文件的方法?
例如,我将文件上传到一个名为的文件夹中cache
,如果一切正常,然后将该文件移入一个store
文件夹并清除缓存(立即或使用后台任务)。
在cache
与store
不同宫的商店(尽管它们属于同一个桶)。
在上传上传到S3的文件时,Shrine会自动执行复制请求。
Shrine.storages = {
cache: Shrine::Storage::S3.new(...),
store: Shrine::Storage::S3.new(...),
}
cached_file = Shrine.upload(file, :cache) # performs a `put_object` operation
stored_file = Shrine.upload(cached_file, :store) # performs a `copy_object` operation
因此,在附件流中,当Shrine将缓存的文件“提升”到永久存储时,内部S3存储将发出复制请求。
由于S3不支持移动对象,因此您可以在复制后直接删除缓存的文件。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句