【发布时间】:2019-06-01 04:06:58
【问题描述】:
我有一个前端组件,它由一个图表和几个不同的过滤器组成,允许用户按数据类型进行过滤。但是,他们过滤的数据比较大,所以我不想把所有的数据都加载到网页中,而是有一个 firebase 云函数来处理过滤。问题是用户在使用这个组件时通常会做一堆过滤,所以云功能重复下载必要的数据是没有意义的。有没有办法将云函数“附加”到调用并使其更新而无需重新检索数据,或者如果不可能,以某种方式将检索到的 Firebase 数据缓存到云函数可访问的某个地方?
exports.handleChartData = functions.database.ref("chartData").onCall((data, context) => {
// can I cache data here somehow
// or can I have this function read in updates from user selected filters
// without having to retrieve data again?
}
【问题讨论】:
-
我不明白你想在这里做什么。但我会说,Cloud Functions 中没有有效的“缓存”。你最好使用客户端缓存。
标签: firebase caching firebase-realtime-database google-cloud-functions