• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Browser Cache Caper

Hey everybody,

I'm using CI's query cache feature and that's working fine, but I am having some issues with browser caching. I read some older threads like this one but haven't been able to find anything that works so far.

We've got some different data coming in from several mysql tables that are updated a few times a day. However, when you go to that page, more often than not an older entry is there and you need to refresh to get something new, and I'd like to have the content just show up.

What I've got in place in the controller:

$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate, no-transform, max-age=0, post-check=0, pre-check=0");
$this->output->set_header("Pragma: no-cache");

What's in the header of the HTML document:

<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="CACHE-CONTROL" content="NO-CACHE">
<meta http-equiv="expires" content="-1">

I'm no expert on browser cache issues, but it is becoming a problem. Does anyone have any tricks or fixes they've found that works beyond what I've got in place?


The browser shouldn't cache HTML pages, are you sure that you're simply sending off the old data to the user?

[eluser]Randy Casburn[/eluser]
Hi frogmoves, when you're having these problems, what is the content of your system/cache folder? Have you set $this->output->cache(n) for any of the pages you're having trouble with? In other words, perhaps it isn't a browser cache problem, but a CI cache problem?


[edited: because my typing skilled stink Undecided ]

I've got the whole database cache clearing after updates, so I'm certain that I'm not sending the old stuff to the user - but I keep getting complaints from users and clients that the pages have to be reloaded to see the content. Pretty crazy stuff.

Weird, are you sure that the cache is cleared? If it's cleared "on the fly" are you certain that you're clearing it before you send the data off.

Hey Randy - I've checked and I haven't used the CI page cache anywhere on the site. We have used the query cache feature, but I've kept careful track of that and I know when there's new content there's no CI-side caches.

Aea - Are you referring to the db query caches? I've been clearing the database caches after inserting/updating new data. Do you think there could be a problem in that process?

[quote author="frogmoves" date="1214463381"]Aea - Are you referring to the db query caches? I've been clearing the database caches after inserting/updating new data. Do you think there could be a problem in that process?[/quote]

That would be my guess, but the problem is something I have never encountered before, can you try to replicate the problem? Use Firebug / Drosera to ensure that the problem comes from the browser cache Smile

Aea - I have Firebug installed (1.2.0b3 on FF3) - I tooled around with it for a while, but could you point me to info I'm looking for to let me know if its the browser cache? I'm not very familiar with Firebug.

[eluser]Randy Casburn[/eluser]
@frogmoves -- OK. So looks like you've eliminated the browser, and you don't user CI 'page' caching. So Aea is likely on the right track. It's likely in your garbage collection routines. it's probably time to put up some code in code tags so we can see how your cache deletion stuff is running. Can we see your controller code that deletes your caches?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.