Welcome Guest, Not a member yet? Register   Sign In
Web Page Caching, Database Caching, Caching Driver explain

I am new to Codeigniter framework and I would like to make a clear picture about caching options I have.

After reading documentation, I know that three types of caching exists in CI:
-Web page caching
-Database caching
-Caching driver

Web page caching can not be used to cache only parts of pages. But I can use for this caching driver. So let's say I want to refresh Profiles page each 10 minutes, but still keeping in cache some results from database.
public function index()
            $this->output->cache(10); //10 minutes        
            $data['newProfiles'] = $this->profiles_model->getNewProfiles();
            if ( ! $data['profiles'] = $this->cache->file->get('profiles'))
                $data['profiles'] = $this->profiles_model->getProfiles();
                $this->cache->file->save('profiles', $profiles, 86400); //86400 s = 24h
            $template['title']= 'Users';            
            $template['body'] = $this->load->view('profiles_view', $data, true);
            $this->load->view('templates/main', $template);                          

In the above code I used page cache which will be refreshed each 10 minutes, including new users, but regular users output will be cached using caching driver for 24 hours because this doesn't need to be refreshed so regular.

Having this example in mind, when does the database cache comes to action? In this case it wouldn't make sense to use the db cache because profiles results output is already cached with caching driver.
When I was reading about the Page cache, I noticed some people arguing that this is not perfect solution because it caches the whole page. Isn't this solved with the Caching Driver which could be used to cache just part of the page? Am I missing something here?

Please help me to understand the whole picture which caching is used when.

Thank you

Theme © iAndrew 2016 - Forum software by © MyBB