Firebase听众在哪里听内存或磁盘? [英] Where does the firebase listeners listen to RAM or disk?

查看:111
本文介绍了Firebase听众在哪里听内存或磁盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在下面的代码中: -

 字符串FirebaseRefer = Constants.Client +/+ Constants.firebaseProjects +/ + Constants.name +/ xyz; 
DatabaseReference agendaRef = FirebaseDatabase.getInstance()。getReference(FirebaseRefer);
agendaRef.keepSynced(true);

agendaRef.addListenerForSingleValueEvent(new com.google.firebase.database.ValueEventListener(){
$ b @Override
public void onDataChange(com.google.firebase.database .DataSnapshot快照){

Firebase侦听器在哪里侦听?是RAM中的firebase数据或者在磁盘上?

解决方案

Firebase数据库客户端会保留您在内存中收听的所有数据的副本一旦你删除了一个位置的最后一个监听器,数据就从内存中移除了,因为你调用了 agendaRef.keepSynced(true),这意味着所有的数据都在 agendaRef 保存在内存中,并保持最新状态。 启用持久性客户端也将持续活动和最近的数据到磁盘。 p>

In the following code:-

 String FirebaseRefer = Constants.Client + "/" + Constants.firebaseProjects + "/" + Constants.name + "/xyz";
DatabaseReference agendaRef = FirebaseDatabase.getInstance().getReference(FirebaseRefer);
agendaRef.keepSynced(true);    

agendaRef.addListenerForSingleValueEvent(new com.google.firebase.database.ValueEventListener() {

    @Override
    public void onDataChange(com.google.firebase.database.DataSnapshot snapshot) {

where does the firebase listener listen to? Is it the firebase data in the RAM or to that in the disk?

解决方案

The Firebase Database client keeps a copy of all data that you're listening to in memory of your app. Once you remove the last listener for a location, the data is removed from memory. Since you call agendaRef.keepSynced(true), this means that all data at agendaRef is kept in memory, and kept up to date.

If you enable persistence the client will also persist active and recent data to disk.

这篇关于Firebase听众在哪里听内存或磁盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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