Go to the FreeLists Home Page Home Signup Help Login
 



[dokuwiki] || [Date Prev] [01-2007 Date Index] [Date Next] || [Thread Prev] [01-2007 Thread Index] [Thread Next]

[dokuwiki] Content-dependent Purge/Cache

  • From: "Todd Augsburger" <todd@xxxxxxxxxxxxxxxx>
  • To: <dokuwiki@xxxxxxxxxxxxx>
  • Date: Wed, 10 Jan 2007 14:35:30 -0500
I have a dokuwiki that appears differently to "editors" (those logged in) 
than to the general public. The editors would like to include comments (on 
wiki pages) that will be invisible to the general public.

So I wrote a plugin which handles the comments properly. However, caching 
needs to be turned off for pages which contain these comments, since they're 
user-dependent. My solution (which works) is:
1) A syntax plugin renders the comment as either visible or invisible, 
depending on the user, then uses p_set_metadata() to set a flag which 
suggests that the page be purged.
2) An action plugin hooks PARSER_CACHE_USE and uses p_get_metadata() to get 
the flag. If set, I then set depends['purge'] = true so that the page is 
refreshed.

However, there is no method (that I can find) for a syntax plugin to _unset_ 
the flag for pages which no longer have comments, so:
3) The action plugin also re-reads the original file, and if it does not 
contain wiki code for a comment, it uses p_set_metadata() to clear the flag, 
essentially refreshing the metadata.

So ... I have 3 specific questions:
1) Is there a better way to accomplish this? (Is there no other way that the 
plugin can request that the page not be cached?)
2) Step 3 seems awkward and inefficient, because I re-read the file when 
it's rarely changed. Is there some other way to tell if the metadata may 
need a refresh?
3) The info at http://wiki.splitbrain.org/wiki:caching says
   "syntax plugins can create metadata for the current page with their 
render() method by handling the $format=="metadata"."
What does THAT mean?

Thanks,
Todd Augsburger
todd@xxxxxxxxxxxxxxxx
Roller Organs
http://www.rollerorgans.com/ 

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




[ Home | Signup | Help | Login | Archives | Lists ]

All trademarks and copyrights within the FreeLists archives are owned by their respective owners.
Everything else ©2007 Avenir Technologies, LLC.