CodeIgniter Forums
How to cache output? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to cache output? (/showthread.php?tid=16095)



How to cache output? - El Forum - 02-24-2009

[eluser]Computerzworld[/eluser]
Hello,
I want to cache my output using
Code:
$this->output->cache(n)
. Actually I want to cache the menu in the header which is a view file. What is the exact syntax of it? So, if user comes for the first time it should cache output & it will load that output from second time onwards. Thanks in advance...


How to cache output? - El Forum - 02-24-2009

[eluser]pistolPete[/eluser]
[quote author="Computerzworld" date="1235498703"]Actually I want to cache the menu in the header which is a view file. [/quote]

CI's standard cache can only handle the caching of full pages.
Have a look at e.g. the following about partial caching:
- http://ellislab.com/forums/viewthread/104228/
- http://codeigniter.com/wiki/MP_Cache:_Simple_flexible_Caching_of_parts_of_code/


How to cache output? - El Forum - 02-24-2009

[eluser]CrossMotion[/eluser]
What you want is Fragment Caching. I had this problem with a project a while ago, I found the following very useful:

http://codeigniter.com/wiki/MP_Cache:_Simple_flexible_Caching_of_parts_of_code/


How to cache output? - El Forum - 02-24-2009

[eluser]Computerzworld[/eluser]
thanks for the reply...
how can i cache full page & load it from cache?


How to cache output? - El Forum - 02-24-2009

[eluser]TheFuzzy0ne[/eluser]
The [url="http://ellislab.com/codeigniter/user-guide/general/caching.html"]CodeIgniter cache method[/url] in the Output class does it all for you.