Output caching in blaze

blaze was optimized to deliver pages as quickly as possible. All components work for that goal, like the asset compiler (all compiled assets are cached), the database handler (as few requests and actions as possible) and so on. But more can be done.

Caching headers

Additionally to the basic components, blaze does come with a fine tuned .htaccess file, which tries to configure the server for perfect file delivery. It will set proper file caching headers (if mod_headers is enabled), correct MIME-types and do some other stuff.

Static output caching

If you are serving lots of page visits (lets say more than a few thousand a day), you will want to optimize your website's performance as much as possible. This is what the output cache, that comes with blaze, was made for. You can enable it in the backend with a click.

Any public visitor who visits your page now will see a cached version of the request answer. blaze will not recompile any assets any more, nor read out your script contents - this does reduce the reponse time by up to 50-60% for a basic html page. It will do even more if you have things that need heavy calculation and take more than average loading times.

Dynamic contents

If you have dynamic contents like page elements that differ depending on the used browser or stuff that comes from a database, they should not be cached. When the output cache is enabled, these pages also will be cached and delivered from cache without rerendering the dynamic content elements.

The solution to this problem: You can enable static output caching and disable it for certain pages. Just call this function somewhere in your script:

    $blaze->output->disableCaching();

This little function will ensure, that the page will not be stored to the output cache. Be aware, that if the page is already in the output cache, you will have to disable output caching once in order to make it rerender including this function.