Sunday, 28 July 2019

Firestore still retrieving documents from cache even though I've disabled it

My Firestore is still retrieving documents from cache even though I've explicitly told it not to:

class MainActivity : AppCompatActivity() {

    val db = FirebaseFirestore.getInstance()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val dbSettings = FirebaseFirestoreSettings.Builder().setPersistenceEnabled(false).build()
        db.firestoreSettings = dbSettings

So above is my launcher activity where I set the Firestore settings. My document reads are in another activity/fragment but that shouldn't matter as this should set the settings for the whole app.

In my fragment:

val instances = FirebaseFirestore.getInstance().collection("instances")
val geoFirestore = GeoFirestore(instances)

Any idea why it's still retrieving documents from cache?

UPDATE: At the moment GeoFirestore is the only code retrieving documents from cache. Examples from my GeoFire onDocumentEntered callback below:

DocumentSnapshot{key=instances/mQhRbBHCiKEB, metadata=SnapshotMetadata{hasPendingWrites=true, isFromCache=true}

DocumentSnapshot{key=instances/d6MsxlZWfgk3, metadata=SnapshotMetadata{hasPendingWrites=false, isFromCache=true}, doc=Document{key=instances/d6MsxlZWfgk3}

Is there a setting in GeoFire to disable cache?



from Firestore still retrieving documents from cache even though I've disabled it

No comments:

Post a Comment