example for caching cloud function for firebase requests and only re cache after a successful edit to the profile

Viewed 4841

In my app, Users profiles are open to the public and only updated by the profile owner.

The profile URL is example.com/profile?user=@user.me

And based on the docs https://firebase.google.com/docs/hosting/functions. I can cache the response JSON of the function, in this case, the public profile. Which will save me a lot of at cloud functions executions and Firebase database bandwidth

And when the user updates his profile, I want to re cache the profile in the CDN.

I think that can be done by making the user re-request his public profile, with Cache-Control: no-cache in the request header, after a successful update of his profile.

And when a user visits that same profile afterward he shall see the new version.

Is that possible ?? or that's not how Cache-Control shall be used.

1 Answers
Related