My CMS is building web pages on the fly, based on a number of components (template, navbar, macros, etc). Most of the content is semi-static. The user edits it once in a while so it can't really be a static page (the application does support mixing virtual and file-based contents already). What I was looking for was a way to still save some load time but keep the dynamic support. The hack I came up with is a bit as follows: I keep a hash in memory with all the necessary information (name, complete content data, modification time) of the contents that need caching (this is set in admin panel). I do a very minimal query from the database to check if caching is needed for the page. If so, I skip all the extras and just dump the cached content. Problems that might arise: