CodeIgniter Forums
Database Cache Creates file but not reading those file. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Database Cache Creates file but not reading those file. (/thread-58559.html)



Database Cache Creates file but not reading those file. - El Forum - 06-24-2013

[eluser]Unknown[/eluser]
Hi Friends,

I am trying to working on database Cache. I follow the following tutorial its really good.

CodeIgniter Project Tutorial - Caching Database Queries

But problem is when I check my cache directory it has cached file and every time when I refresh same page it takes same time and generate new cache files in cache directory.

Is any one have any suggestion. Why its not loading from cache file.
Following is my model code:
Code:
$sql = "Some Query";
if($where != "")
        {
            $sql .= " WHERE " . $where;
        }
  [b]$this->db->cache_on();[/b]
  //Counting all queries before appling limit
  $count_query = $this->db_cflux_2point0->query($sql);
  
        if($order_by != "")
        {
            $sql .= " ORDER BY $order_by $asc_desc";
        }
        if($limit != "")
        {
            $sql .= " LIMIT $start, $limit";
        }
  
        $query = $this->db_cflux_2point0->query($sql);
  [b]$this->db->cache_off();[/b]

  
        //Result Query
  $result['list_stories'] = $query->result();
  
  //Count Query
  $result['num_rows'] = $count_query->num_rows;
  
  return $result;

Waiting for your response
Thanks in advance