but I could receive any version of my perl at any time.

I guess you mean that at your browser you receive the output produced when your server runs your Perl scripts. If I have guessed wrong then what follows probably isn't relevant.

If you sometimes receive old content after having received new content then it isn't a simple caching problem.

Do you have a pool of caching proxy servers between your browser and server? If so, each proxy server might have cached a different version of response and, depending on which server the load balancer sends your latest request to, you might get various ages of responses somewhat randomly. Controlling expiry will solve this problem if the proxy servers are well behaved. In development I would bypass all proxy servers and query the source server directly, if at all possible, until I was sure the server was stable and correct, then test through the proxy servers to ensure that caching wasn't causing a problem.

If there are proxy servers between browser and origin server, can you inspect their logs to find out what requests they receive and what they do to respond to them?

this is a server problem not a client problem, right?

When you receive old content at your browser, does your server access log show that the request made it all the way to the server? Your content may be delivered in parts through several requests: a main document and many linked documents (images, css, javascript, etc.). If content is not being served from a cache then you should see a record of each part being accessed in your server's access log.

Setting the cache expiry on the document produced by your Perl script will not affect caching of other linked documents.

If you are going to control caching, it would be better to put the controls in the HTTP headers rather than in the HTML. You can't add meta tags to images, as far as I know, and I suspect not in your javascript either (though I could be wrong about the latter). There is a nice tutorial at http://www.mnot.net/cache_docs/ that explains some of the options and issues.

You may find the apache mod_expires module helpful for adding HTTP headers related to caching: http://httpd.apache.org/docs/2.0/mod/mod_expires.html


In reply to Re: apache/perl caching problem by ig
in thread apache/perl caching problem by ksublondie

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.