Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable firestore cache for specific document?

I'm using Firestore offline cache with timestamps to get only the latest documents from the server. When I load data for the first time it will get data in ascending order of timestamps. this practice saves me many documents reads.

But the problem is I'm using dynamic links in my app. when a user opens my app with a dynamic link it will get the appropriate document from the Firestore server and it saves in the cache by default. If there is no data for a particular collection in the users device and if the dynamic link data loads the latest timestamped document, then it affects my above Firestore reads optimization.

So I want to disable offline cache for the specific documents (loaded from the dynamic links). I had seen this offline persistence documentation but doesn't helped me.

Any solution to disable offline cache for a specific document in Firestore or Modify the cached document timestamp?

like image 203
Venkat Avatar asked Nov 17 '25 04:11

Venkat


1 Answers

So I want to disable offline cache for the specific documents

That's currently not possible. You cannot disable the offline persistence only for some documents. It's the entire database (up to the configured cache size) or nothing.

like image 185
Alex Mamo Avatar answered Nov 18 '25 20:11

Alex Mamo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!