by oconnore · 14y ago · 0 comments
What you should be doing is caching that big time consuming job (I guarantee you aren't timing out someone's browser with template code) at the model level, and then generating pages off of that cached result. Feel free to further cache the HTML too, but the bulk of the win is from decoupling long running jobs from your display code.
If you want to ensure that the user sees the absolute latest, use an AJAX call to pull the more recent result after serving the previously cached result.