Reputation: 4264
I have a frontend component that consists of a chart and several different filters that allow users to filter by data type. However, the data that they are filtering is relatively large, and so I do not want to load all of it into the webpage, and instead have a firebase cloud function handle the filtering. The issue is that users will usually do a bunch of filtering while using this component, so it does not make sense for the cloud function to repeatedly download the necessary data. Is there a way to "attach" the cloud function to the call and have it update without having to re-retrieve the data, or to somehow cache the retrieved firebase data somewhere accessible to the cloud function if this is not possible?
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?
}
Upvotes: 0
Views: 853
Reputation: 598847
You can write data to the local /tmp
disk. Just be aware that:
/tmp
disk space is a RAM disk, so any files written there will come out of the memory you've allocated for your Cloud Functions containers.Also see:
Upvotes: 3