Jump to content

How to stop jpgraph (gd library) from caching or to force a refresh


uncleronin

Recommended Posts

I'm using a bunch of graphs all over my site to display various statistics. Some pages have lots, some have one. The big issue is that if I display the graphs for a particular page multiple times in a row (changing the parameters each time) the graphs don't refresh. Instead the same graphs are shown each time!

 

Is this because of caching or some php setting or some apache setting (using apache2 btw)? Is there any way to get around this or to force the graphs to refresh?

Link to comment
Share on other sites

Refreshing the page doesn't help. I've even gone so far as to prevent the actual page from caching but that doesn't do much either. Then again, images cache differently to pages. In IE the graphs refresh nicely but in FF the caching is handled differently so they dont refresh. I dunno, maybe FF has a cache setting somewhere but I have no idea how to force it to refresh pages. Maybe there's something in PHP which does this?

Link to comment
Share on other sites

Maybe try this in your script:

 

<?php

header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past

?>

 

taken from www.php.net

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.