Partial offline sync in Firebase Cloud Firestore
Asked Answered
P

1

0

I want to offline sync some collections in Firebase Cloud Firestore to Android phone local store.

Some collections(E.g. log data) size are too large and are not needed to sync to phone local store.

Anyone can provide guidance for this?

Panne answered 1/2, 2018 at 5:8 Comment(0)
S
4

Your client will only persist those documents that it has previously read. It won't be an entire collection unless all those documents were read, and only up to a reasonable limit. Old documents will be evicted from the cache when new documents are read.

Since you haven't really voiced your specific concern about what might happen with offline caches, I'll assuming that you haven't actually observed any negative behavior, and you are just concerned that a large collection will not cause your app problems.

Spall answered 1/2, 2018 at 5:39 Comment(2)
I need to keep some collections in phone. But some collection contains log data and shouldn't be kept in phone. How I choose not to offline sync the collection that contains log data?Panne
There is currently no API to prevent specific collections from being cached. If a user can read the data, the data is considered eligible for caching. If you want more control over caching priorities, I'd suggest that you file a feature request.Stabile

© 2022 - 2024 — McMap. All rights reserved.