firebase - 可调用函数支持缓存吗?

标签 firebase google-cloud-functions

我想知道是否可以将缓存控制设置应用于可调用函数的响应。我们之前使用过 http 触发器并切换到可调用函数,但找不到任何方法来接管缓存控制 header 。

更具体地说:http 触发的云函数允许这样的缓存设置:

exports.myFunc = functions.https.onRequest((req, res) => {
  res.set('Cache-Control', 'public, max-age=600, s-maxage=1200');
  ...
}

当我们迁移到可调用函数时
exports.myFunc = functions.https.onCall((data, context) => {
  ... 
  /* no res-object for cache-control? */
  ...
})

它在我们的应用程序中被调用如下:
const myFunc = functions.httpsCallable('myFunc');
myFunc({params}).then(result => ...)

我们找不到在任何地方应用缓存设置的方法。

最佳答案

目前无法使用可调用函数设置响应 header 。如果这对您很重要,请file a feature request.

关于firebase - 可调用函数支持缓存吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50303355/

相关文章:

java - Firebase 错误 - 无法在 Android Studio 中计算属性 'extraGeneratedResDir' 的值

java - 如何以正确的方式将java对象写入firebase?

firebase - Firebase 异步等待样式的云功能

node.js - 用于导出 Firestore 备份数据的云功能。使用 firebase-admin 还是 @google-cloud/firestore?

python - 云函数发生未知错误: GCP Python

firebase - 在 Firebase Cloud Functions 中记录 'jsonPayload'

java - mChart android颜色没有改变

ios - 如何存储(在变量中)从 Xcode 中的数据库读取的 Firestore 文档数据

android - 从 android 中的 Firebase 数据库读取特定值

javascript - 部署 Firebase 云函数时出错 每个 then() 都应返回一个值或抛出异常