Firebase Android-只需特定表即可在本地设备中 [英] Firebase Android - Only need specific table to be in local device

查看:59
本文介绍了Firebase Android-只需特定表即可在本地设备中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Android应用程序中使用Firebase实时数据库.我使用下面的代码行在本地设备中复制了数据库- FirebaseDatabase.getInstance().setPersistenceEnabled(true);

I am using Firebase realtime database in my Android application. I have replica of database in local device using below line of code - FirebaseDatabase.getInstance().setPersistenceEnabled(true);

但是它将在本地数据库和全局数据库之间同步所有表.我只希望少数几张表需要全部同步.

But it will sync all the tables between local and global database. I only want few table need to be sync not all.

有什么方法可以只同步本地内存中的几个表,而其余的Android设备表将从全局数据库中读取吗?

Is there any way to only sync few tables in local memory and rest of table Android device will read from global database?

推荐答案

使用以下代码行时:

FirebaseDatabase.getInstance().setPersistenceEnabled(true);

用户最近收到的所有数据被缓存到磁盘.

有什么办法只能同步本地内存中的几个表,而其余的android设备表将从全局数据库中读取吗?

Is there any way to only sync a few tables in local memory and the rest of the table android device will read from the global database?

不,没有!无法从磁盘持久性中排除某些节点.不幸的是,您无法选择是否应该在磁盘上缓存节点.是全有还是全无.

No, there is not! There is no way to exclude certain nodes from that disk persistence. Unfortunately, you cannot choose whether a node should be or shouldn't be cached on the disk. It's all or nothing.

这篇关于Firebase Android-只需特定表即可在本地设备中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆