[Mediawiki-l] Turn off caching for a specific page?

Rob Church robchur at gmail.com
Sat Aug 11 06:05:15 UTC 2007


On 11/08/07, Frederik Dohr <fdg001 at gmx.net> wrote:
> There's a function invalidateCache() which does the following:
>      Title :: newFromText($titles[$i])->invalidateCache();

Title::invalidateCache() will not turn off the parser cache for a
specified page. What it does is updates the page.page_touched column
of the corresponding page, forcing existing cached copies to be
discarded, and will send appropriate purge notices to configured Squid
servers.

In code, it's quite possible to instruct the parser not to cache the
current output, using $parser->invalidateCache(), where $parser is, of
course, the current parser as passed to the parser function or tag
callback.

This means it's quite trivial to write something to handle <nocache />
or even __NOCACHE__, although there's nothing official of that nature,
because we prefer to encourage developers to ensure that caches are
used, and remain coherent.


Rob Church



More information about the MediaWiki-l mailing list