iswan
iswan

Reputation: 92

Browser Caching problems

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

Answers (3)

thaJeztah
thaJeztah

Reputation: 29137

To prevent the browser from caching the cart page, add a 'no-cache' header;

Disable browser-caching in CakePHP 1.x

public function cart()
{
    $this->disableCache();
    // rest of your code here
}

Disable browser-caching in CakePHP 2.x

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

Kamal Pundir
Kamal Pundir

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

liyakat
liyakat

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

Related Questions