firebase - 如果我第二天打开应用程序,Firestore 是否会再次收取文档读取费用?

标签 firebase google-cloud-firestore

我没有找到任何解决方案来避免使用 get() 时从服务器读取数据。但是,我可能找到了解决方案,但我不清楚它是否有效。我发现在使用实时功能时,客户端会随着数据的变化而不断更新。所以根据我的理解,如果服务器上没有任何更改,则不会收取任何读取费用,对吗?

但是,我读到 listener should be removed ,我明白了为什么,但我不明白的是,如果我关闭应用程序(监听器被删除)并在第二天打开应用程序,我是否会再次为前一天缓存的数据付费?

我真的很困惑,因为我也读过:

  • 此外,如果监听器断开连接超过 30 分钟(例如,如果用户离线),您将需要支付读取费用,就像您发出了全新的查询一样。

去掉监听器和上网,不是一回事吗?

最佳答案

I found that when using the real-time feature, the client will continuously update as the data changes. So per my understanding, if nothing is changed on the server, no reads charged, right?

到达服务器的每个查询都会引发对该查询返回的文档的读取。每当从服务器返回文档时,都会花费一次读取时间。如果您对一组查询结果有一个监听器,其中在监听器处于事件状态时只有一个文档发生更改,则需要执行一次读取操作,因为只有一个文档必须来自服务器,其余文档已在内存中。它们会保留在内存中,直到监听器被删除。

if I close the app (listener is removed) and I open the app the second day, am I charged again for the data that was cached a day before?

是的。每当结果来自服务器时,您都将为这些读取付费。当使用服务器作为源时,缓存不用于满足查询结果。

Removing the listener and going online, are not the same exact thing?

它们不是同一件事。删除监听器表示您已完全完成查询结果。暂时上线并重新上线只会恢复现有查询。

关于firebase - 如果我第二天打开应用程序,Firestore 是否会再次收取文档读取费用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61971764/

相关文章:

javascript - 如何避免可观察的 Angular 延迟或确保仅当可观察准备好时才调用我的函数

firebase - RxJs 组成一个 Observables 列表,然后组合(Firebase)

Firebase Google Auth离线access_type以便刷新 token

android - Firebase 实时数据库删除特定用户

javascript - 如何更新 firebase 中的文档?

javascript - 如何比较 firebase 时间戳?

asynchronous - 如何使用异步函数异步监听 Firestore 中的值?

firebase - 如何发出 firestore REST API PATCH 请求?

firebase - 找不到插件项目:firebase_core_web

firebase - Flutter如何以另一种方法从Firestore传入documents.length?