How to limit Firebase database persistence store to only some nodes?

本秂侑毒 提交于 2021-02-08 04:42:31

问题


Adding the following code to the AppDelegate will make the Firebase database available when the user is off-line:

FIRDatabase.database().persistenceEnabled = true

How can we make just some parts of the database available in off-line mode and some parts available just when the user is on-line?


回答1:


Short answer: you can't. Firebase don't currently provide such a fine grained persistence scope API.

What you can do instead is decrease/increase the amount of disk space used by the persistence cache. By default, it will use up to 10MB of disk space to cache data (a small amount by today standards, by the way). This is controlled by the FIRDatabase.persistenceCacheSizeBytes property.

For instance, using a larger cache might hold more nodes from your desired subset... if you are lucky :)

Conversely, a smaller value might affect your network performance/cost in significant ways.



来源:https://stackoverflow.com/questions/44086631/how-to-limit-firebase-database-persistence-store-to-only-some-nodes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!