【发布时间】:2019-07-16 14:16:36
【问题描述】:
我们正在使用 firebase 实时数据库,我正在考虑在本地实现缓存以减少重复调用。
所以我想出了一个涉及房间持久性库的算法。
stream only the latest data from firebase
store in room cache
when requested fetch all data from room cache and return
但后来我开始考虑 firebase 提供的缓存,并开始意识到我可能完全可以避免使用房间库。
stream only the latest data from firebase
when requested call fetch data using a singleValueListener
由于我们使用单值侦听器,因此只会从 firebase 获取缓存的数据。
使用第二种方法的缺点是什么?我知道 firebase 缓存限制为 10MB,所以可能是一个
【问题讨论】:
标签: android firebase-realtime-database android-room