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

#1
[eluser]adamfairholm[/eluser]
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:

Code:
$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:

Code:
<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?

Thanks!

#2
[eluser]Aea[/eluser]
The browser shouldn't cache HTML pages, are you sure that you're simply sending off the old data to the user?

#3
[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?

Randy

[edited: because my typing skilled stink Undecided ]

#4
[eluser]adamfairholm[/eluser]
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.

#5
[eluser]Aea[/eluser]
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.

#6
[eluser]adamfairholm[/eluser]
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.

#7
[eluser]adamfairholm[/eluser]
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?

#8
[eluser]Aea[/eluser]
[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

#9
[eluser]adamfairholm[/eluser]
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.

#10
[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?

Randy


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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