[ic] IE caching problems?

Mike Heins mikeh@minivend.com
Fri, 2 Feb 2001 06:37:14 -0500

Quoting Ron Phipps (rphipps@reliant-solutions.com):
> Wow that simple?  Does it send both the header and the meta tag equivalent?

Nope. It uses a more reliable method -- unique integer always in the URL.
That should work even for stubborn proxy caches. I think you could have
grepped the docs and figured that one out -- I would leave you to do that
but I think this might be helpful to a few people and I need to start building
my library of FAQs back up.

FAQ: Why does MSIE cache my pages?

If the user has the settings in Internet options set to "Never", "Once
per session", or "Automatically", which is typical, then this might be
a problem.  If you have the scratch value mv_no_count set (the default
in our demos, see catalog.cfg), then the URL will appear as a simple
.html page.

This is good in the general case, as caching can reduce load on your
system. If you want to have constantly changing dynamic content, however,
then it might be a problem.

You can get caching effects on any browser, if they have an analogous
function. Netscape/Mozilla does -- see the "Edit Preferences" under
Advanced->Cache.  It is not quite as aggressive in its caching behavior,
however, and problems are fewer.

The way to defeat it for all browsers is to remove this line from

	ScratchDefault  mv_no_count  1

This causes a unique integer to be appended to all URLs except
form POSTs. It defeats caching when that is at all possible.

A good way to do this is to only turn off caching for logged-in
users. If they don't have an account on your system, you may not
have much dynamic to show them. To do this, place

    [set mv_no_count][/set]

on the destination page for logged in users.

If you prefer to keep the unique integer out of the URL, and you
trust proxy servers to honor the parameter (hah!), you can do:

Autoload   <<EOA
[if session browser =~ /MSIE/]
[tag op=header]Pragma: no-cache[/tag]

or even

Autoload   <<EOA
[if session browser =~ /MSIE/]
    $Variable->{NO_CACHE} = '<META HTTP-EQUIV="Pragma" content="no-cache">';

with __NO_CACHE__ in the header for pages you don't want cached.

This may not work well for AOL, as their proxy servers are extremely
aggressive when there are no QUERY_STRING parameters.

On a busy system this method can place a bit of additional load on the
system and is not real desirable. For best performance you should define a 
GlobalSub and just pass the routine name:


GlobalSub <<EOS
sub standard_autoload {
    if ($Session->{browser} =~ /MSIE/) {
	$Tag->tag( { op => 'header', body => 'Pragma: no-cache' } );


Autoload  standard_autoload

TIP: It performs better because it is precompiled and is a simple
subroutine call -- very fast. It is the way to do very complicated
processing for every user without incurring lots of tag parse
overhead on every access. A few little tags in Autoload won't
kill you, but I wouldn't want to do a lot on a busy system.

Red Hat, Inc., 131 Willow Lane, Floor 2, Oxford, OH  45056
phone +1.513.523.7621 fax 7501 <heins@akopia.com>

I don't want to get to the end of my life and find I have just
lived the length of it. I want to have lived the width of it as
well. -- Diane Ackerman