Extension:NoCache

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
NoCache

Release status: unknown

Implementation Tag
Description Add a __NOCACHE__ magic word to disable cache
License No license specified
Download See below
Hooks used
ParserBeforeStrip

Check usage (experimental)

[edit] NOCACHE extension

  • I want something simple - extension that creates an extra magicword __NOCACHE__
  • Any page containing the nocache magicword IS never cached by the file caching/mem cache
  • I'm using file caching and DynamicPageList2 - The dynamic lists created by DPL2 are cached and not very dynamic
  • I'm using 1.8.2 on PHP5 and the newest edition of Dpagelist2
  • I'm using $wgShowIPinHeader = false; $wgUseFileCache = true;

If you can code this extension and it works - I'm happy to paypal some thanks! mrshlee@gmail.com


Version by AzaToth 22:00, 26 November 2006 (UTC)

$wgExtensionFunctions[] = 'noCache';
 
function noCache() {
        global $wgHooks, $wgParser;
 
        $wgHooks['ParserBeforeStrip'][]= 'disableCache';
 
}
 
function disableCache(&$article, &$text, &$strip_state) {
        $counter = 0;
        $text = preg_replace( '#__NOCACHE__#', '' , $text , -1 , $counter );
        if( $counter > 0 ) {
                $article->mTitle->invalidateCache();
        }
}

Doesnt seem to work for me.

<!-- Served by host11.hostmonster.com in 0.590 secs. -->
</body>
<!-- Cached 20061127125718 -->

This is probably irrelevent by now, but try this Nad 22:13, 11 June 2007 (UTC)

$wgHooks['ParserBeforeStrip'][] = 'wfNoCache';
function wfNoCache(&$article,&$text) {
        global $wgEnableParserCache,$wgOut;
        $text = str_ireplace('__NOCACHE__','',$text,$count);
        if ($count>0) {
                $wgEnableParserCache = false;
                $wgOut->mCacheTime = -1;
                }
        return true;
        }

[edit] See also

Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Print/export
Toolbox