Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Firebase Admin SDK perform any caching?

I've been using firebase with cloud functions recently and this question popped into my mind.

If in my cloud function, using the Firebase Admin SDK, perform multiple reads to the same document in a single function call, will it count as multiple reads in the database or will it cache the data?

Example:

await admin.firestore().collection("users").doc("user_id_here").get();
await admin.firestore().collection("users").doc("user_id_here").get();
await admin.firestore().collection("users").doc("user_id_here").get();

Will this code above cause multiple reads or only one?

like image 826
Vinicius S. Avatar asked May 16 '26 16:05

Vinicius S.


1 Answers

The Firebase/Cloud server SDKs don't do any persistent caching like the Firebase client SDKs. What you've written will perform three document reads.

like image 65
Doug Stevenson Avatar answered May 18 '26 10:05

Doug Stevenson



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!