Reputation: 8584
I want users to have the most recently updated values for a ref of my database but the reading of those values to be quick as my UI depends on them. For this reason I've set FIRDatabase.database().persistenceEnabled = true
to allow for data to be cached locally, as well as having my ref's synced using FIRDatabase.database().reference().child("usersRef").keepSynced(true)
.
After reading Frank van Puffelen's SO answer on how to keep values synced but also cached it appears that another option would be to use observe()
in iOS (or addValueEventListener()
for android) to accomplish this same thing.
What are the advantages to using the observe()
method as compared to keepSynced(true)
. Is one faster than the other? Does one have more overhead? Is one more "accurate" than the other?
Upvotes: 0
Views: 122
Reputation: 599081
Calling keepSynced(true)
on a node, keeps an active listener on that node. There isn't more to it then that.
Upvotes: 1