forked from sjlu/CodeIgniter-Bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Caching
sjlu edited this page Jun 26, 2012
·
4 revisions
If you're running any page that doesn't fully require dynamic content, it might be in your best interest to cache the page. Especially in high request projects or environments.
Some things to keep in mind when caching.
- Avoid doing any "tickers" for page counts or anything of that sort. They won't work with caching and to put it simply, its really not worth the performance downgrade.
- If you do "page" type caching, you have to consider that you cannot clear this cache dynamically. You would want to use the "memory" caching tool if you want to do this.
All you need to do is add this one line in.
$this->output->cache(n);
Where n is the number of minutes you'd like to keep the cache for. If you don't want to use the cache anymore, simply just get rid of that line.
You will need to note that CodeIgniter will keep this cache based on the input of the URL. For example controller/function/var1 will cache differently to controller/function/var2.
You must use CodeIgniter "views" in order for this to work properly.