How can I disable the http cache on Yii? The browser can't update the view, until I refresh the browser manually.
Is there some like cakephp disableCache()?
CakePHP's function does
$this->header(array(
'Expires' => 'Mon, 26 Jul 1997 05:00:00 GMT',
'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'
));
so maybe you can make a function with:
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
and call it when needed.
Check your filters() method inside your controller and/or base controller (if you're using it). There should be something like 'CHttpCacheFilter' in it, just remove that. By default HttpCache isn't enabled.
More details: http://www.yiiframework.com/doc/guide/1.1/nl/caching.page#http-caching
If you don't use the CHttpCacheFilter, check your .htaccess file, perhaps there is some http caching done as well.
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