Firebase Admin SDK是否执行任何缓存? [英] Does Firebase Admin SDK perform any caching?

查看:71
本文介绍了Firebase Admin SDK是否执行任何缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近一直在使用具有云功能的Firebase,这个问题浮现在脑海.

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

如果在我的云功能中,使用Firebase Admin SDK在一个函数调用中对同一文档进行多次读取,它将计为数据库中的多次读取还是将其缓存数据?

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?

示例:

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?

推荐答案

Firebase/Cloud服务器SDK不像Firebase客户端SDK那样执行任何持久性缓存.您所写的内容将执行三个文档读取.

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.

这篇关于Firebase Admin SDK是否执行任何缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆