I am new to web dev (but I have >20 years experience with C++/C# dev). I feel like this is such an obvious pattern that it must have a) a name and b) an off-the-shelf implementation I can just use, but I'm not turning up anything obvious with extensive googling.
The behaviour that I want to have is the following. On an incoming URL request for an MP4 file, check if the requested media exists in persistent storage.
- If the media already exists, just serve it.
- If the media does not exist, spin up an expensive and heavy JS stack to dynamically render the media, store result to persistent storage, and serve the result.
Two complicating factors:
- I want to be able to trigger a re-render of the media if necessary (for example if the source data or compression params change)
- I want to ensure that parallel requests for cache-miss media (case 2.) do not trigger parallel render jobs.
What's the name of this design pattern, and what is the least-effort solution?
I already have a working Google Cloud Function prototype for the "spin up expensive and heavy JS stack and render the media" part, but I'm not sure how to implement the rest. Will I need a database of some kind to keep track of render operations and thus avoid parallel redundant render jobs?
Aucun commentaire:
Enregistrer un commentaire