Does Firebase Admin SDK perform any caching?

人走茶凉 提交于 2021-01-28 10:08:18

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/59146727/does-firebase-admin-sdk-perform-any-caching

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!