Daniel Kinzler has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/98512


Change subject: Document parser cache key control.
......................................................................

Document parser cache key control.

This documents how implementations of the Content interface
can control the parser cache key by calling ParserOutput::recordOption()

Change-Id: I9e8ad1e33e06aceea6e63c7d5575679f84ce4004
---
M includes/content/Content.php
M includes/parser/ParserCache.php
M includes/parser/ParserOutput.php
3 files changed, 14 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/12/98512/1

diff --git a/includes/content/Content.php b/includes/content/Content.php
index da49ced..2d1a506 100644
--- a/includes/content/Content.php
+++ b/includes/content/Content.php
@@ -252,6 +252,10 @@
         * is needed, $generateHtml can be set to false; in that case,
         * $result->getText() may return null.
         *
+        * @note To control which options are used in the cache key for the
+        *       generated parser output, implementations of this method
+        *       may call @see ParserOutput::recordOption() on the output 
object.
+        *
         * @param $title Title The page title to use as a context for rendering
         * @param $revId null|int The revision being rendered (optional)
         * @param $options null|ParserOptions Any parser options
diff --git a/includes/parser/ParserCache.php b/includes/parser/ParserCache.php
index 7043b4a..b1b5500 100644
--- a/includes/parser/ParserCache.php
+++ b/includes/parser/ParserCache.php
@@ -118,6 +118,9 @@
         * It would be preferable to have this code in get()
         * instead of having Article looking in our internals.
         *
+        * @note Which parser options influence the cache key
+        *       is controlled via @see ParserOutput::recordOption()
+        *
         * @todo Document parameter $useOutdated
         *
         * @param $article     Article
diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php
index 2950227..096aa6a 100644
--- a/includes/parser/ParserOutput.php
+++ b/includes/parser/ParserOutput.php
@@ -453,10 +453,14 @@
        }
 
        /**
-        * Callback passed by the Parser to the ParserOptions to keep track of 
which options are used.
-        * @access private
+        * Tags a parser option for use in the cache key for this parser output.
+        * Registered as a watcher at ParserOptions::registerWatcher() by 
Parser::clearState().
+        *
+        * @see ParserOptions::optionsHash
+        * @see ParserCache::getKey
+        * @see ParserOptions::registerWatcher
         */
-       function recordOption( $option ) {
+       public function recordOption( $option ) {
                $this->mAccessedOptions[$option] = true;
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/98512
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9e8ad1e33e06aceea6e63c7d5575679f84ce4004
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Daniel Kinzler <daniel.kinz...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to