Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
I have a problem with preventing the web clients from caching my scrolling graph and would like to seek your helps. Attached below is a piece of my code. Basically, the code would display a continuous scroll graph. However, the second time I ran the code, the same image is redisplayed on the client screen. If I clicked on refresh, then I would see a new image. I searched the web and the examples I found are similar to this
print "Content-type: image/gif\n\n"; print "Cache-control: no-cache\n"; print "Pragma: no-cache\n"; print "Expires: Mon, 06 May 1996 04:57:00 GMT\n";
However, when I put this into my code, I got an error about incorrect format in my image and nothing is display on the client window. I had to move the
print "Content-type: image/gif\n\n";
below the other three lines to get the error message to go away but then I have a caching problem. Any helps would be appreciated. Thanks.
my @data = ( \@xlabel, \@reads, \@writes, \@updates ); my $graph = GD::Graph::lines->new(400,300); $graph->set( x_label => 'Average Read/Write/Update', y_label => 'Performance ms', title => 'Performance Monitor', y_min_value => 0, y_max_value => $ysp, y_tick_number => 5, y_label_skip => 'auto', x_label_skip => 10, box_axis => 0, ) or die $graph->error; $graph->set_legend( 'Read/Item', 'Write/Item', 'Update/Item'); my $myimage = $graph->plot(\@data); print "Cache-control: no-cache\n"; print "Pragma: no-cache\n"; print "Expires: Mon, 06 May 1996 04:57:00 GMT\n"; print "Content-type: image/gif\n\n"; print $myimage->gif; print "\n"; print "\n--magicalboundarystring\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Preventing Web Client From Caching
by wind (Priest) on Aug 04, 2007 at 02:39 UTC | |
by Anonymous Monk on Aug 04, 2007 at 04:09 UTC | |
by dsheroh (Monsignor) on Aug 04, 2007 at 16:27 UTC | |
|
Re: Preventing Web Client From Caching
by derby (Abbot) on Aug 04, 2007 at 17:18 UTC | |
|
Re: Preventing Web Client From Caching
by planetscape (Chancellor) on Aug 04, 2007 at 20:21 UTC |