简体   繁体   English

如何在 JavaScript SDK 中的 Firebase Firestore 中仅缓存选定的文档

[英]How to cache only selected documents in Firebase Firestore in JavaScript SDK

I'm making a chat app and I want Firebase Firestore database to cache only that messages which are sent by me or for me.我正在制作一个聊天应用程序,我希望 Firebase Firestore 数据库仅缓存由我或为我发送的消息。 How can I do this?我怎样才能做到这一点? Can I control what documents are cached in Firestore database?我可以控制在 Firestore 数据库中缓存哪些文档吗? Thanks.谢谢。

The Firestore SDK provides no direct control over the cache, other than its total size, and whether or not it's active. Firestore SDK 不提供对缓存的直接控制,除了其总大小以及它是否处于活动状态。 The documentation describes everything you can do.文档描述了您可以做的所有事情。

One alternative is to only use the SDK to read documents that should be cached, and use the REST API for all other reads that should not be cached.一种替代方法是仅使用 SDK 读取应缓存的文档,并使用REST API进行所有其他不应缓存的读取。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 reactJS 仅获取 Firebase/Firestore 中的文档列表 - How to get ONLY list of documents in Firebase/Firestore using reactJS 如何在 firebase firestore 中的集合文档之间循环? - How to loop between documents of a collection in firebase firestore? 如何按日期对 firebase firestore 文档进行排序? - How to sort firebase firestore documents by date? Web 应用程序:Firestore 缓存 - 仅读取更改的文档 - Web app: Firestore cache - read changed documents only Firebase Cloud Firestore,如何使用 javascript 仅接收 4 个文档? - Firebase Cloud Firestore, How to receive only 4 document using javascript? 如何使用 javascript 删除 Firestore 上的所有文档 - how to delete all documents on firestore using javascript Firebase:使用JavaScript SDK加入Firestore文档结果 - Firebase: Joining Firestore Document Results w/ JavaScript SDK 如何在 Firebase Cloud Firestore 中删除具有相同键值的集合中的文档 - How to delete documents in a collection with the same key value in Firebase Cloud Firestore 如何遍历 Firebase Firestore 文档数组并将值推送到数组中 - How to loop through an array of Firebase Firestore documents and push values into array 如何在本机反应中从 firebase 火库中获取除一份以外的所有文件? - How to get all documents but one from firebase firestore in react native?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM