[pmwiki-users] cache control
5ko at 5ko.fr
Tue Nov 24 21:44:51 CST 2009
On Wednesday 25 November 2009 01:45:11 Daniel Otis wrote:
> Hmm, I am trying to implement the guidelines layed out at
> http://code.google.com/speed/page-speed/ and it seems convinced that the
> pages need a cache directive. Perhaps pmwiki handles caching
> differently than it expects.
You may want to read a page from these same guidelines:
And if you still haven't, look at the RFC 2616 link that I gave you in the
previous message, and which is also linked from the same guidelines you're
trying to implement.
And if you still haven't, check your server logs for " 304 " responses, like I
suggested. You'll be surprised that it actually works! :-)
With $EnableIMSCaching = 1; PmWiki allows all browsers to cache all pages that
are cacheable. Instead of ETag, PmWiki uses a Cookie header which is more
widely supported. It cannot set a max-age because you can modify any page at
any time: if it did, your visitors would view their old cached version even
if your wiki has a newer version.
What happens: the browser caches the page, and when you reload it, it issues a
conditional request. If the wiki was modified, the full page is sent, if not,
only a header "304 Not modified" is sent, and your browser shows the cached
page. This is the fastest-practical-speed strategy for a dynamic website.
And there is no such thing "Cache-Control: cache". Refer to the RFC which is
the standard for the browser/server transfer protocol.
> Petko Yotov wrote:
> > On Tuesday 24 November 2009 18:43:16 Daniel Otis wrote:
> >> $HTMLHeaderFmt['cache'] = "<meta http-equiv='Cache-Control'
> >> content='cache' />"; to my config.php
> > It is Cache-Control: no-cache (just tested it on your server) and it is
> > the correct thing to do, refer to
> > http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9
> > Cache-Control: no-cache is about required validation, not about caching
> > by the browser, but about caching by proxies -- the browser always asks
> > the server if the page has changed, and if not, PmWiki sends a "304 Not
> > modified" header and exits. It should work on your own site, check your
> > apache logs and you'll have a number of 304 responses.
> > Note that a wiki page may include other pages, pagelists and conditional
> > markup. Finding the actual Last Modified timestamp of all included pages
> > is quite complex, so PmWiki just sends the timestamp of the latest edit
> > of the latest edited page in the wiki - it's simpler, even if some
> > browsers may download the same content twice.
More information about the pmwiki-users