How to prevent view cache in one controller method?
  • I have a view that uses some frequently updated data from a remote source, in fact the updates could be arbitrary. The view is being cached though, & I'd like to turn off cacheing (but keep the assets cached). Is this possible?
  • Is this a page from the CMS? If so, you can check the "no" radio for the Cache option in the CMS.
  • No it's a regular controller view. I tried using the headers to prevent cacheing, and the asset library continues to optimise and concatenate the scripts & css, which is what I wanted, and it all seems to work. I just wondered if there was a "Fuel way" of achieving this!

    Does Fuel augment Codeigniter's cache behaviour in these situations?
  • FUEL uses it's own caching library separate from CodeIgniters:
  • Yes - I use this a lot now with all sorts of resources - queries especially like so:

    // try cache
    $cache_id = 'mycache';
    if(!$data = $this->fuel->cache->get($cache_id)) {
    $data = $this->data_model->find_all_array(NULL, 'last_modified DESC');
    $this->fuel->cache->save($cache_id, $data, NULL, 3600);
    // ....use the $data as intended

    But there is no "exclude from cache" in its methods? Ultimately I used this:

    $this->output->set_header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . ' GMT');('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
    $this->output->set_header('Pragma: no-cache');
    $this->output->set_header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!