Query caching with Codeigniter

The Database Caching Class permits you to cache your queries as text files for reduced database load. You can select to cache all queries or a single query.
Query Caching is most effective in reducing load time of search. Now here are some steps you need to follow in order to do it.

Step 1: create a folder for cache files in  your-project/application/cache/your-folder-name 

Step 2: set the path to your cache folder and enable caching in application/config/database.php 
             You need to set two config variables 

$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = 'application/cache/your-folder-name';

You are good to go for caching all query data. Here is one important tip :
To enable caching manually : put $this->db->cache_on(); in modal code
To disable caching manually : put $this->db->cache_off(); in modal code

if you have done some update with data then use $this->db->cache_delete_all(); to clear old cache.