[dokuwiki] Re: Turning off caching from plugin using PARSER_CACHE_USE
- From: Chris Smith <chris@xxxxxxxxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Fri, 20 Apr 2007 14:25:18 +0100
Myron Turner wrote:
I'm writing a plugin that needs to disable caching on a page by page
basis.
According to the DokuWiki page on caching, it is possible to turn off
caching from a plugin:
http://wiki.splitbrain.org/wiki:caching#purging_the_cache
It says that "Plugins can now influence cache use via the
PARSER_CACHE_USE event," and that the way to do this is to "add an
action plugin component to handle the PARSER_CACHE_USE event". But
I'm not clear about what the action plugin is supposed to do once it's
been called.
I tried calling PHP's touch() from within the plugin but this causes a
message to come up asking the user to choose between the version
currently being edited and the apparently newer version.
Thanks,
Myron Turner
_____________________
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/
Hi,
For an example of its use, take a look at the action component of the
source plugin. It expires the cache if the included source file has
changed. I think the current include plugin also uses the event.
Basically the event wraps around the logic to determine whether or not
the cache should be used. The event result will contain that
information. TRUE to use the cache. FALSE to not use it.
To prevent cache use, you should:
- handle the BEFORE advise
- set an event result of false
- prevent the default action
- stop further propagation
To force cache use, you can do the same, but set an event result of true.
For more details of the caching system take a look in include/cache.php
Cheers,
Chris
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist
- Follow-Ups:
- [dokuwiki] Re: Turning off caching from plugin using PARSER_CACHE_USE
- From: Myron Turner
- References:
- [dokuwiki] How to have externally generated pages versioned?
- From: Marc Haber
- [dokuwiki] Re: How to have externally generated pages versioned?
- From: Gina Häußge
- [dokuwiki] Turning off caching from plugin using PARSER_CACHE_USE
- From: Myron Turner
Other related posts:
- » [dokuwiki] Turning off caching from plugin using PARSER_CACHE_USE
- » [dokuwiki] Re: Turning off caching from plugin using PARSER_CACHE_USE
- » [dokuwiki] Re: Turning off caching from plugin using PARSER_CACHE_USE
http://wiki.splitbrain.org/wiki:caching#purging_the_cache
It says that "Plugins can now influence cache use via the
PARSER_CACHE_USE event," and that the way to do this is to "add an
action plugin component to handle the PARSER_CACHE_USE event". But
I'm not clear about what the action plugin is supposed to do once it's
been called.
I tried calling PHP's touch() from within the plugin but this causes a message to come up asking the user to choose between the version currently being edited and the apparently newer version.
Thanks, Myron Turner _____________________ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/
- [dokuwiki] Re: Turning off caching from plugin using PARSER_CACHE_USE
- From: Myron Turner
- [dokuwiki] How to have externally generated pages versioned?
- From: Marc Haber
- [dokuwiki] Re: How to have externally generated pages versioned?
- From: Gina Häußge
- [dokuwiki] Turning off caching from plugin using PARSER_CACHE_USE
- From: Myron Turner