Check cache, then dispatch
Imagine a weblog-like page that allows users to post comments which show up under the main article text. That is, the article and the comments appear on the same page. There is no other dynamic content besides the comments. Thus, the page can be cached in between comment postings.
If I dispatch requests to the backend (python) server to determine the freshness (ETag, last-modified) of the page, then my performance will be limited by the performance of the python server. Instead, I would like to implement the following logic (ignoring error handling for now):
For every GET, If /dev/shmem/path/to/page.html does not exist, dispatch the request to the back end, which will generate /dev/shmem/path/to/page.html. Then, send /dev/shmem/path/to/page.html.
Importantly, if the cached page already exists, then I don't want to contact the back end server at all.
What is the best way to implement this strategy with Litespeed? Or, at least, is it possible? I know how to do it with nginx.