CodeIgniter Forums

Full Version: Database Cache Creates file but not reading those file.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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