Reputation: 3872
Firebase caching is still a mystery to me.
I am querying same real time database by two different methods. The database has persistence enabled
Imagine there are 6
entries 1, 2, 3, 4, 5, 6
[ 2, 3, 4, 5, 6 ]
FirebaseDatabase.getInstance().getReference(path).query.orderByKey().limitToLast(count)
But when second time I run the first query again it returns the same value [2, 3, 4, 5, 6]
while it should return 3-7
if firebase was caching value instead of query results.
Upvotes: 0
Views: 1243
Reputation: 40582
Firebase Realtime Database and Firestore both cache data locally. The nuances of how and when data is downloaded vary, but essentially adhere to this simplified model in Realtime Database:
Firestore works a bit differently and I'm not sure on the nuances, but I'll try to get those documented here as well for reference.
Upvotes: 2