Welcome Guest, Not a member yet? Register   Sign In
[CLOSED] Caching In Codeigniter
#1

[eluser]riwakawd[/eluser]
I have created a model function for my store but unsure what to put

This

Code:
$store_data = $this->cache->get('store+index');

Or

Code:
$store_data = $this->cache->get('store');

What is best.

Code:
public function getStores($data = array()) {
$store_data = $this->cache->get('store+index');

if (!$store_data) {
  $query = $this->db->query("SELECT * FROM " . $this->db->dbprefix . "store ORDER BY url");
  $store_data = $query->result();
  $this->cache->save('store', $store_data);
}
  
return $store_data;
}




Theme © iAndrew 2016 - Forum software by © MyBB