[dokuwiki] Re: Turning off caching from plugin using PARSER_CACHE_USE
- From: Myron Turner <turnermm02@xxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Fri, 20 Apr 2007 17:09:23 -0500
Chris Smith wrote:
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
I couldn't find it in the include plugin but the code in your source
plugin should do the trick. Thank you very much.
Myron
--
_____________________
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist
- 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
- [dokuwiki] Re: Turning off caching from plugin using PARSER_CACHE_USE
- From: Chris Smith
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
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_cacheIt 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] 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
- [dokuwiki] Re: Turning off caching from plugin using PARSER_CACHE_USE
- From: Chris Smith