codeigniter output cache doesn't work? codeigniter output cache doesn't work? codeigniter codeigniter

codeigniter output cache doesn't work?


Two things, as outlined in the documentation:

Warning: Because of the way CodeIgniter stores content for output, caching will only work if you are generating display for your controller with a view.

Perhaps not using the "native" views is an issue?

Additionally:

Note: Before the cache files can be written you must set the file permissions on your application/cache folder such that it is writable.

Are you sure your application/cache directory has the correct permissions?


Debug this file and check it's actually writing the cache:system/core/Output.php

// Do we need to write a cache file?  Only if the controller does not have its// own _output() method and we are not dealing with a cache file, which we// can determine by the existence of the $CI object aboveif ($this->cache_expiration > 0 && isset($CI) && ! method_exists($CI, '_output')){    $this->_write_cache($output);}

This works well for me:

function _output($content) {        // Load the base template with output content available as $content        $data['content'] = &$content;        $this->output->cache(600);        $output = $this->load->view('base', $data, true);        $this->output->_write_cache($output);        echo $output;    }


Are you sure your application/cache directory has the correct permissions?

you you to directories application/cache in cpanel , permissions become 777 is OK