Home

Advertisement

Customize

Codeigniter & cache

Codeigniter has a neat little caching feature that does basic caching of rendered pages. If you run a high load server this tends to be very helpful. Speeding up the delivery process by showing rendered HTML files reduces the overall load on your server, less DB hits, less processing power required to run scripts and so on. But, there are a few catches.
The inbuilt caching system will only work on views.
To make matters worse, it will render the first load of a page, after it expires, so if you have a site that has logged users, such as a "welcome back username", then this page will be stored as your home page. This does give the impression that the user is logged for all computers.

There are quite a few workarounds for this, and most of them involve using plugins or libraries for CI.
I have found that using these, can be helpful, but I still think that they lack some functionalities I´d like to have for my own site.
I am an old-timer, so I am pretty used to the caching model from Smarty, which served me well in a number of occasions. After ggling around the web a bit, I found this link:
http://devcha.blogspot.com/2007/12/smarty-as-template-engine-in-code.html
which shows you how to integrate Smarty into your CI install. It works like a charm (even though I have done very limmited testing on it so far.

If you are in love with CI like I am, but you still miss having Smarty, this might just be the solution for your problems. Thanks Marinov for the work!

Comments

Advertisement

Customize