Solved

Cacheing cgi

Posted on 2000-03-06
2
215 Views
Last Modified: 2013-12-25
I have a cgi script which creates a HTML page with graphics. Everytime the script loads, the graphics would load again.
How do I cache the graphics in a CGI generated html page?
0
Comment
Question by:Aphroditus
  • 2
2 Comments
 
LVL 10

Accepted Solution

by:
makerp earned 50 total points
ID: 2587557
in the header you need set the expiry of the page.

in perl using the cgi.pm module the following will make a page expire in 3 days

use CGI;

$query = new CGI;

print $query->header(-expires=>'+3d');

+30s                              30 seconds from now
        +10m                              ten minutes from now
        +1h                               one hour from now
        -1d                               yesterday (i.e. "ASAP!")
        now                               immediately
        +3M                               in three months
        +10y                              

if your using C/C++ etc then you will need to send this header out in the response to the client before your body of the doc goes out. w3.org will give you the correct header format for the date of expiry etc.
0
 
LVL 10

Expert Comment

by:makerp
ID: 2589011
you can use -expires=>now as the parameter for expriry if you want it not to be cashed. also i think that browser settings override this cash.

i.e if your browsers set to always get a new page then cashed items are ignored.
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
exchange, scripts 3 73
Access Control Entries lost in Windows folders 3 57
Disk Ram Peak 1 49
Is it possible to create a playfile with setacl or icacle? 3 51
In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question