Codeigniter database cache : Database caching allows you to cache your query results as text file to reduce the server load.
Codeigniter database cache example
$this->db->cache_on() is used to enable database caching.
$this->db->cache_on(); $query = $this->db->query("seelct * from users");
If you are using multiple queries and you want to enable for some of them you can use $this->db->cache_off();
$this->db->cache_on(); $query = $this->db->query("seelct * from users"); $this->db->cache_off(); $query = $this->db->query("seelct * from profile"); $this->db->cache_on(); $query = $this->db->query("seelct * from city");