I am using codeigniter with MySQL.
One of my database is a price_table that is quite constant and gets "SELECT" quite often, the access where through the same model_function, so the query would be exactly the same. I think this should be a good example to implement MySQL cached query to improve performance.
I want to use codeigniter function to interact with database as much as possible, so I have codes like:
$q = $this->db->select('service_info.*, service_pricing.price, service_pricing.price_ID')
->from('service_pricing')
->where('status','active')
->join('service_info','service_info.service_ID = service_pricing.service_ID ')
->get();
if ($q->num_rows > 0) {
return $q->result_array();
} else {return FALSE;}
I read about the Database Caching Class from codeigniter document, but I do not think this is what I want. The cache described here seems like a global one. In my case, I want it to be a few queries about a relatively constant database.
I am thinking something like this example:
SELECT SQL_CACHE id, name FROM customer;
Is there a good way I can do it in codeigniter? Thanks!