Firebase存储图像缓存不起作用

编程入门 行业动态 更新时间:2024-10-13 02:16:02
本文介绍了Firebase存储图像缓存不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有两个图像uri,第一个位于 firebase存储中,第二个是 react-native博客中的示例图像.

There are two image uri, first one is located in firebase storage and second one is a sample image in react-native blog.

而且我相信recat-native的Image组件是可缓存的.

And I believe recat-native's Image component is cacheable.

<View> <Image style={{ width: 100, height: 100 }} source={{ uri : 'firebasestorage.googleapis/v0/b/siren-5eee7.appspot/o/profile%2FmO2vxzWDbJRzM5ckzCBXtf0aPhV2?alt=media'}} /> <Image style={{ width: 100, height: 100 }} source={{ uri : 'facebook.github.io/react-native/img/react-native-congratulations.png'}} /> <View>

问题

我认为Firebase存储的映像未缓存.当我渲染屏幕时,它总是尝试下载.因此,第二个图像的加载速度更快,一秒钟后,firebase图像也会加载.

I think firebase storage's image is not cached. when I render screen it always trying to download. So the second image load faster, and after one second, firebase image is loaded.

如何使Firebase存储映像可缓存?

您可以测试上面的代码!

You can test above code!

推荐答案

firebase.google/docs/reference/js/firebase.storage.SettableMetadata#cacheControl

请参阅此文档,我认为您必须在将图像存储到Firebase存储器时设置元数据.

See this documentation I think you have to set metadata while storing the image to the Firebase storage.

更多推荐

Firebase存储图像缓存不起作用

本文发布于:2023-11-26 08:38:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1633404.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:缓存   不起作用   图像   Firebase

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!