DokuWiki

It's better when it's simple

User Tools

Site Tools


devel:event:parser_cache_use

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
devel:event:parser_cache_use [2009-11-25 02:03] – remove duplicated plugin name 87.194.159.222devel:event:parser_cache_use [2023-09-02 13:57] (current) – [Passed Data and Result in event handler] Klap-in
Line 8: Line 8:
 ---- ----
  
-Signalled by by cache versions of parser wrapper functions [[xref>inc/parserutils.php]]. Syntax plugins can use this event to provide their own assistance to DokuWiki's cache validity logic when the syntax extension adds other dependencies to the rendered page.+Signalled by cache versions of parser wrapper functions [[xref>inc/parserutils.php]]. Syntax plugins can use this event to provide their own assistance to DokuWiki's cache (from cache key, via cache file location to validity logicwhen the syntax extension adds other dependencies to the rendered page.
  
-===== Passed Data =====+===== Passed Data and Result in event handler ===== 
 +The passed [[xref>dokuwiki\Extension\Event]] has the fields ''$data'' and ''$result''.
  
-$data is a cache object -- refer [[xref>inc/cache.php]].+''$data'' is a cache object ([[xref>dokuwiki\Cache\CacheParser]] or extended on that object) -- refer [[xref> inc/Cache/CacheParser.php]].
  
-For handling the event, key properties of the cache object are:+For handling the event, key properties of the CacheParser object are:
  
-  * page, if present the wiki page id, may not always be present, e.g. when called for locale XHTML files +  * ''$page'', if present the wiki page id, may not always be present, e.g. when called for locale XHTML files 
-  * file, source file +  * ''$file'', source file 
-  * mode, renderer mode (e.g. 'XHTML') or 'i' for instructions +  * ''$mode'', renderer mode (e.g. 'xhtml') or 'i' for instructions 
-  * depends, array of dependencies used to determine cache validity+  * ''$key'', primary identifier, will be md5 hashed part of the cache file 
 +  * ''$ext'', secondary identifier, extension of the cache file, readable part 
 +  * ''$cache'', cache name generated by [[xref>getCacheName()]] 
 +  * ''[[xref>$depends]]'', array of dependencies used to determine cache validity
  
-===== Plugins handling this event =====+In the BEFORE event handler the cache object can be modified. Some examples are: extending the ''$depends'' field, using more cachefiles for variants of the same source file (see also [[plugin:struct]] plugin)  or preventing and replacing the default ''makeDefaultCacheDecision()'' cache check.
  
-The following plugins are known to handle this event and their source code may be a good start for understanding and implementing a handler yourself.+In the AFTER event handler the ''$result'' field is set with the result of the [[xref> makeDefaultCacheDecision()]] method. The AFTER event handler can modify this field.
  
-  * [[plugin:dokuwikifck]], [[plugin:htmlokay]], [[plugin:include]], [[plugin:indexmenu]], [[plugin:indexmenu2]], [[plugin:navi]], [[plugin:prolog]], [[plugin:qstat]], [[plugin:randominc]], [[plugin:source]] 
  
 ===== See also ===== ===== See also =====
  
 +  * [[codesearch>PARSER_CACHE_USE|Code related to this event]] used in any DokuWiki's files, plugins and templates
 +  * [[devel:caching#plugins|Influencing of cache by plugins]]
   * [[devel:Action Plugins]]   * [[devel:Action Plugins]]
   * [[devel:Events]]   * [[devel:Events]]
  
  
devel/event/parser_cache_use.1259110994.txt.gz · Last modified: 2009-11-25 02:03 by 87.194.159.222

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki