Disabling caching in MediaWiki

After fighting with MediaWiki for a while, I finally figured out how to disable all forms of page caching so that it actually hands over the latest version of a given page when I ask for it.

To disable caching (including memcached) add the following lines to your LocalSettings.php file:

## Disable all forms of MediaWiki caching $wgMainCacheType = CACHE_NONE; $wgMessageCacheType = CACHE_NONE; $wgParserCacheType = CACHE_NONE; $wgCachePages = false;

You probably already have the $wgMainCacheType line, so just add the other three lines if you need those.

As a side note, you should make these changes in LocalSettings.php rather than in DefaultSettings.php (as some have recommended). DefaultSettings.php should not be edited, and is there just to give you a list of all of the available settings and their default values.

7 Responses to “Disabling caching in MediaWiki”

  1. Marcel Says:

    Thanks, this really helped me!

  2. Tobi Says:

    Thank You… exactly what i’ve been searching for…. (for a few hours now)…

  3. Steven Larmore Says:

    What version of mediawiki?

    ~Steve

  4. John Says:

    Steven:

    Do you mean which version was I using when I wrote this post? At the time I think I was using MediaWiki 1.7.1.

    - John

  5. Jay Says:

    Thanks, this helped me too!

  6. Robert Fleming Says:

    See also:

    http://www.mediawiki.org/wiki/Extensions_FAQ#How_do_I_disable_caching_for_pages_using_my_extension.3F

  7. zsh Says:

    Thanks.

Leave a Reply