Update: I've decided to work on this again and re-release it. It should now work fine with Concrete5's built in caching enabled and without having to change your stylesheets to be directly linked in. It also has some other critical bugs fixed, in particular file downloads work correctly now.
It is still very experimental, so use with caution.
I’m a big fan of Concrete5. The system is incredibly powerful, flexible, easy to develop and most of all easy for end users. However, it can at times be a little ‘heavy’ on a server, so I looked into a way to add a lightweight cache around it. Many sites are really quite static, so this cache addition is designed to try to make Concrete5 as ‘static’ in performance as possible.
I based the cache policy on the following thinking:
First download and unzip the file at the end of this post. Drop into the libraries folder of the root level of the Concrete5 site the bootstrapcache folder.
Edit dispatcher.php in the /concrete folder:
Add in the line:
Events::fire('on_page_view', $c, $u);
At this stage, the cache should already be working, but you can turn on a debug option to check this:
The default config works fine, but I’ve set it up to look in site.php for config items. Through the config, caching can be enabled/disabled, debug mode switched on, the default cache time set, pages added to an exclude list, or pages added to a list where they have custom cache times. If you do add excluded pages, make sure you still specify the two login pages that need to be in that list. So add to the normal site.php config file items from the following:
I hope someone finds this useful. For me it makes a few sites start to feel like static sites, which is a good thing!
Updates made: 16/05/2011 - change to the way files are identified, fixes to excluded pages handling. The below file has been updated.
Changes for 5.5.x: this concept was originally for 5.4.x. It does work with 5.5.x, but the instructions had to change a bit. It's still a work in progress.