Reputation: 92
I created a shopping cart application but after add items to shopping cart from products page and then go to the cart page cart is showing empty, but after refresh product is showing, I think browser caching pages. So Is there a method to fix this issue, Please help me
Note: I used cakephp framework with MVC
Thanks
Upvotes: 0
Views: 546
Reputation: 29137
To prevent the browser from caching the cart page, add a 'no-cache' header;
public function cart()
{
$this->disableCache();
// rest of your code here
}
In CakePHP 2.x the 'disableCache()' method has been moved to the response-object
public function cart()
{
$this->response->disableCache();
// rest of your code here
}
Upvotes: 2
Reputation: 287
Every time you are making call to your page add some time stamp to the address or url like
get current time in variable MS(jav mili second time can be used) and change your URL lik myPage.jsp?MS
Thanks
Upvotes: 0
Reputation: 11853
You can do so by calling
Cache::clear()
This will clear all cached data, excluding cached view files. If you need to clear the cached view files, use
clearCache().
Upvotes: -1