[Pmwiki-users] Re: 404 caching

Evan Prodromou evan
Thu Jul 8 12:10:28 CDT 2004


J. Meijer wrote:

>Hi Evan, I've read your contribution and clear explanations. Useful subject.
>I'm learning.
>  
>
Thanks. It's pretty interesting.

>Hey you're from wikitravel, coming over to pmwiki? Hmmm. Did you say people
>over there have like tons of hair coming out of their ears? You shouldn't
>start rumours like that.
>  
>
Yeah, it's true.

Not sure yet what use I'm going to put PmWiki to for Wikitravel.

>You mention in your TODO:
>- need better invalidation, now 404-chache invalidates all of the cache
>after an edit.
>- need cache management to limit cache size. So cache only a number of
>pages.
>
>It struck me that both needs can be met through a simple rule: invalidate
>the page after it has been there for an hour. Or after it has been edited.
>When there is high traffic on a page, it will come from cache, otherwise
>pmwiki will regenerate it. So when the site suddenly becomes the hit it is
>supposed to be, the wiki-server won't go down.
>  
>
So, the main thing is that when you change a page, there may be other 
pages that depend on the state of that page for their content. Some 
examples:

    * If the page is new, other pages that link to it will still have
      links in the "missing page" style. They need to be regenerated to
      have the "existing page" style.
    * If the page is being deleted, the opposite happens. Linking pages
      still need to be invalidated.
    * If anything includes the page, the cached version will contain the
      old contents. So those need to be invalidated, too.
    * If GroupHeader, GroupFooter, or $Group.SideBar change, the
      appearance of all the pages in the group change. So all the group
      pages need to be updated.

It's tricky to figure out all this stuff, but I think it's possible. I 
wrote up a WhatLinksHere module to try to figure out these dependencies:

    http://www.pmwiki.org/wiki/Cookbook/WhatLinksHere

...and I'm going to try to make the 404 cache work with it in the near 
future. The general strategy being that when a page is edited and saved, we:

   1. Invalidate the cache page for the currently edited page.
   2. Invalidate the cache pages for any pages that depend on the
      current page (per WhatDependsOn()).
   3. If this is a new or deleted page, invalidate the cache pages for
      any linking pages.

The advantage here is that we only invalidate cache pages for pages 
actually affected by the change.

>Indeed (a patched) pmwiki could assist the WhatDependsOn and WhatGoesHere.
>Should you really require these functions, I'm not convinced yet.
>  
>
I'd love to see the dependency and backlink functionality implemented in 
PmWiki.

>I'd sure like to use your script.
>
I'd like it to be useful. B-)

~ESP



More information about the pmwiki-users mailing list