I'm building a cache plug-in layer for q2a. The basic idea is that, for most pages, the entire page can be cached, while other pages can only cache certain sections.
For pages like home that build elements from different places, I'm going to cache each major section as a cache file. When that part of the page is being built, I'll check if there's a cache file for it and use that. If there isn't I'll execute the code and store the result in a cache file to use next time.
For pages like a question, the entire page can be cached until there's a change event. To do this, I'm going to deliver the cached version of the entire page in the init of the modual if it's not a POST. If there's no cache file, I'm going to let the page execute and capture the output for the cache by turning on the output buffer with ob_start. If there's an event (like an upvote or comment) I'll delete the cache file so a new cache file could be created.
I'm going to store all cache information under the question ID so that I can wipe out the entire cache for that question, insuring the most up-to-date result each time.
Is this something you'd like to us? Please add your feedback and suggestions on this idea.
Edit: The existing version is very buggy. Use it for informational purposes only, not in a production environment. I'm working on an update that'll address a lot of the issues with this beta version.