问题描述
在下面的代码中: - 字符串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听众在哪里听内存或磁盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!