I'm trying to learn Codeigniter and understand the basics so far, but as I try to test, it seems the cache is getting in the way. Normally when I test on localhost I make a change and instantly can see it in browser, but with Codeigniter it seems I have to wait ~1 minute for changes to be seen in browser. Is there a way to universally disable the Codeigniter cache so when developing changes happen immediately?
Clearing a cached path You can clear any specified path of its cache by calling $this->output->clear_path_cache('path/to/clear'); . This method will return boolean TRUE if successful, FALSE if not.
CodeIgniter lets you cache your pages in order to achieve maximum performance. Although CodeIgniter is quite fast, the amount of dynamic information you display in your pages will correlate directly to the server resources, memory, and processing cycles utilized, which affect your page load speeds.
Just put this code in the __construct function of controller
$this->output->set_header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . ' GMT');
$this->output->set_header('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");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With