Codeigniter Cache |
[eluser]rallport[/eluser]
Have been using CI for a couple of weeks now and am loving it I been looking at the forum a lot and decided to register. I'm aware CodeIgniter has a pretty basic caching library as standard (but am aware there are a couple of PEAR style CodeIgniter cache libraruies about like http://philsturgeon.co.uk/code/codeigniter-cache). Say I did the following in a controller: Code: function index() .. this should cache my view - blog/blog_view for 2 mins, which it does. However, am I not still making a call to the database? In the past, any caching librraies I've used, such as PEAR cache lite do the following: Code: $cache_id = '1234'; Is Codeigniter doing a similar thing, or is the database call being made anyway? Thanks
[eluser]Twisted1919[/eluser]
When using the $this->output->cache() the entire output is generated and cached. Next time when a request is made, is the cache file for that page is already created, it will be served without hitting the database. Note that output->cache() is based on uri segments. I assume that using Phil's cache library gives you more flexibility, as you can cache page fragments or database results or array/objects, and is pretty easy to use.
[eluser]rallport[/eluser]
Ah thanks. Was just wondering, as all the caching libraries I've used had a similar style to the bit of code I posted |
Welcome Guest, Not a member yet? Register Sign In |