Cache System for Ionize

...trying to use the CodeIgniter 1.7 cache system in a real-world website.

friday 13 may 2011 at 12h27

We recently had a discussion with an user who developped a big website with Ionize. His website uses about 10 <ion:articles /> calls on home page.
The website rendering was quite slow...

Even it is better, for big website, to use a dedicated cache system, most of the modern CMS have an internal cache system, which is quite enough for middle sized wesbites. Ionize had none.

Why had Ionize no cache system, don't you shame ?

Ionize is based on CodeIgniter 1.7.3.
The framework has its own cache system, which caches the whole pages.
This approach can be good for small wesbites which has no forms and no user's based dynamical data.

But... if your website integrate a contact form or displays data from logged in users, the CI cache can't be used anymore as it is, because once one page is cached, it will display the logged in username from the request which created the cache.

What's the ideal cache solution for Ionize ?

Ionize's views (templates) use tags.
Each tag returns the result of some process (the page title, a list of articles, one navigation menu, current logged username, etc.).

The best approach is to cache (or not cache) each tag, regarding the URL it is called, and to return the cached content if the tag is called in the same URL context.
So, some tags could be cached and some other not. The tag developper will the define which tag can be cached.
This approach will also give the ability to manage more precisely the cache files. For example, in case of a page creation, only the <ion:navigation /> tag cached files need to be deleted.

What is done... now ?

For the next release (0.9.7), we made several changes :

  • We optimized some internal processes, to gain 15% of performance. This optimization will not have a big impact on very big websites.
  • We added the CI cache system, slightly modified so forms and users data can be used.

Can this temporary cache system be used on a productive website ?

Yes... but with limitations :

  • I'm using a contact form : Yes, you can activate the cache. The requests containing POST data and the resulting pages will not be cached.
  • I'm using a login form and users can log to my website : Yes, you can use the cache. Once logged, the cache is unactivated. So pages displayed to a connected user will not be cached. The negative point is that the user will see the website slow down, depending on the website complexity.

Ideal vs. existing cache system, did you plan something ?

Yes we do.
As it will take some time, we will not develop the "tag based" cache system until the 0.9.8.

But that's in our todo list.