Posted by: pvibeesh on: February 21, 2008
Upto cakephp 1.1.19.x there is no builtin function for this so,One solution is
Send the below headers before render a view
header(“pragma: no-cache”);
header(“Cache-Control: no-cache, must-revalidate”);
header(“Expires: Mon, 26 Jul 1997 05:00:00 GMT”); // Date in the past
you can place the above code in the function beforeRender or layout file.
Cakephp 1.2.x contains a function Controller::disableCache() this will avoid the browser page caching by sending the corresponding headers.
[...] Cakephp how to avoid browser page caching « vibeesh’s Weblog In CakePHP 1.2: Controller::disableCache() (tags: cakephp cache) Posted by Richard@Home Filed in 15 [...]
February 21, 2008 at 7:12 am
Exactly
You can apply this to entair pages by defining the beforeRender function inside app_controller
/**
* beforeRender() Called after the controller action is run, but before the view is rendered
*/
function beforeRender() {
header(“Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0″); // // HTTP/1.1
header(“Pragma: no-cache”);
header(“Expires: Mon, 17 Dec 2007 00:00:00 GMT”); // Date in the past
}
Or you can specify these headers in default.thtml layout between header tags