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

#11
[eluser]Randy Casburn[/eluser]
@frogmoves -- forget the browser for now -- one step at a time ?

#12
[eluser]adamfairholm[/eluser]
Here is a bit of code from my post controller - it basically updates content on the site:

Code:
//Everything above here inserts data into the table

//CACHE delete
$this->db->cache_delete($data['type'], 'index');
if($cache_type=="blog"){$this->db->cache_delete_all();}

Below that is loading the view. $data['type'] is just the first uri segment determined by a variable in the URI of the admin back end. I've tested this and it clears the proper cache area. If its the blog then it needs to clear everything to clear the main page cache that the blog feeds into.

#13
[eluser]Randy Casburn[/eluser]
@frogmoves --
Quote:I’ve tested this and it clears the proper cache area.
Didn't mean to waste your time. Just trying to help.

Regards,

Randy

#14
[eluser]adamfairholm[/eluser]
[quote author="Randy Casburn" date="1214468327"]@frogmoves --
Quote:I’ve tested this and it clears the proper cache area.
Didn't mean to waste your time. Just trying to help.

Regards,

Randy[/quote]

Sorry Randy, I didn't mean it that way, I just wanted to make it clear what had been tested and what hadn't.

I did find an answer to this problem, and I believe it lies in adding an extra header:

Code:
$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate");
$this->output->set_header("Cache-Control: post-check=0, pre-check=0", false);
$this->output->set_header("Pragma: no-cache");
$this->output->set_header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

That last line sets it to a comically outdated date and it seems to do the trick - nothing is cached on the pages with this header.

Additionally, in my research on this I've found that the third line really does nothing, but it makes me feel better to have it in there.

#15
[eluser]Randy Casburn[/eluser]
Hey, the headers in the orginal post through me. Can I blame all this on Microsoft? (hehe) Here's a KB article that explains why the top one worked intermittantly but not always. Also, probably why I fell for it hook,line and sinker -- cause I'm old dog trying to learn all this new crap all the time. %-P

http://support.microsoft.com/kb/234067

Anyway. Glad you got it sorted.

Randy


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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