title: Codeigniter cache controller issue
body: <p>I have 2 controllers:</p>
  
  <pre><code>cart/
  cart/buy
  </code></pre>
  
  <p>In both show the contents of the library Cart</p>
  
  <pre><code>    &lt;tbody&gt;
          &lt;?php foreach($this-&gt;cart-&gt;contents() as $items): ?&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;?php echo $items['name'] ?&gt;&lt;/td&gt;
              &lt;td&gt;$ &lt;?php echo $this-&gt;cart-&gt;format_number($items['price']); ?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $items['qty'] ?&gt;&lt;/td&gt;
              &lt;td&gt;$ &lt;?php echo $this-&gt;cart-&gt;format_number($items['subtotal']); ?&gt;&lt;/td&gt;
          &lt;/tr&gt;
              &lt;?php endforeach; ?&gt;
      &lt;/tbody&gt;
  </code></pre>
  
  <p>My problem is that the controller <strong>buy</strong> remains in cache when I add the first item to the cart. I mean, the controller <strong>cart/</strong> have 5 items and the controller <strong>cart/buy</strong> have 1 item. I have to press Ctrl + F5 to see all items</p>
  
  <p>I was able to solve this part to:</p>
  
  <pre><code>function buy()
      {
  
          $this-&gt;output-&gt;set_header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . ' GMT');
          $this-&gt;output-&gt;set_header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
          $this-&gt;output-&gt;set_header('Pragma: no-cache');
          $this-&gt;output-&gt;set_header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');  
  
          if($this-&gt;cart-&gt;contents())
          {
  
              $this-&gt;load-&gt;view('web/products/buy_view');
          }
          else
          {
              redirect('cart');   
          }       
  
      }
  </code></pre>
  
  <p>But see, I want to know if there is data in the cart and redirect to another page if the cart is empty. </p>
  
  <p>Apparently <strong>if($ this->cart->contents())</strong>, "remains in cache", as for example the cart can be filled in <strong>cart/</strong> but empty in <strong>cart/buy</strong> and until I press Ctrl F5 condition was still failing.</p>
  
  <p>Is there any way to fix this, or maybe I'm doing something wrong?</p>
  
  <hr>
  
  <p>p.d. My add method in cart controller:</p>
  
  <pre><code>function add_item()
      {
          if($this-&gt;cart_model-&gt;validate_add_item() == TRUE)
          {  
              redirect('cart');
          }
      }
  </code></pre>
  
  <p>My add method in cart model:</p>
  
  <pre><code>function validate_add_item()
      {
          $id = $this-&gt;input-&gt;post('producto_id'); 
          $cantidad = $this-&gt;input-&gt;post('cantidad');
  
          $this-&gt;db-&gt;select('vNombre, dPrecio');
          $this-&gt;db-&gt;where('iIdProducto', $id);
          $query = $this-&gt;db-&gt;get('product', 1);
  
          if($query-&gt;num_rows &gt; 0)
          { 
  
              foreach ($query-&gt;result() as $row)  
              {  
  
                  $data = array(  
                          'id'      =&gt; $id,  
                          'qty'=&gt; $cantidad,  
                          'price'  =&gt; $row-&gt;dPrecio,  
                          'name'  =&gt; $row-&gt;vNombre  
                  );  
  
  
                  $this-&gt;cart-&gt;insert($data);   
  
                  return TRUE;    
              }
          }
          else
          {  
              return FALSE;  
          }   
      }
  </code></pre>