[dokuwiki] Re: Content-dependent Purge/Cache

  • From: Chris Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Thu, 11 Jan 2007 15:54:34 +0000

Todd Augsburger wrote:
Chris & Ben, these are great ideas. The multi-cache would be superior to my method.

The only thing I cannot figure out is how to tell _which_ cache to use: I do not need (or want) to use additional cache files for _all_ pages--only those which contain comments. So within PARSER_CACHE_USE I'll still need to determine whether or not the wiki page has comments.

The only solutions I can think of:
1) have a duplicate cache for _all_ pages
or
2) re-read the wiki to see if it still contains comments
Or is there a better way?


I get around this by ensuring the syntax plugin component writes a metadata key to indicate its presence in the page. That is easy for the include plugin as there is a defined key - relation hasPart. A bigger problem is not knowing if that relation hasPart was put there by the include plugin of by something else. Take a look at the dublin core pages to see if there are any metadata keys which match your needs. If not, make one up.

If you take a look at the code I provided a link to earlier, you'll see the first few lines in processing the event are to do with deciding whether or not "the plugin" has any interest in the page. I think the checks are:
- is it a wiki page?
- is it being rendered for xhtml (or whatever render modes the plugin supports).
- is there a metadata key that the plugin recognises

if any of these are failed the plugin exits immediately.

the plugin then calculates the correct cache name and modifies the cache name on the cache object to the new name. DW's cache handling then determines whether or not to use it. You can also expire the cache there and then or add additional dependencies for DW to check (both of these facilities are used by the include plugin).

Cheers,

Chris
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: