How to prevent MediaWiki caching pages: Difference between revisions

From Cookipedia

no edit summary
No edit summary
No edit summary
 
Line 2: Line 2:
|title=How to prevent MediaWiki caching pages
|title=How to prevent MediaWiki caching pages
|titlemode=replace
|titlemode=replace
|keywords=How to prevent MediaWiki caching pages
|keywords=#howtopreventmediawikicachingpages #help #meatcookingtimecalculator
|hashtagrev=12032020
|description=Adding this as a personal aide-memoir, that may also prove useful to others. A MediaWiki caches pages for efficiency reasons.
|description=Adding this as a personal aide-memoir, that may also prove useful to others. A MediaWiki caches pages for efficiency reasons.
|og:image=https://www.cookipedia.co.uk/img/cookipedia-logo.png
|og:type=article
}}
}}
<!-- /seo -->
<!-- /seo -->
Adding this as a personal aide-memoir, that may also prove useful to others.
Adding this as a personal aide-memoir, that may also prove useful to others.
<GoogleBanner></GoogleBanner>
 
====MediaWiki caching====
====MediaWiki caching====
A MediaWiki caches pages for efficiency reasons.  The MediaWiki pages are created by parsing multiple tables within a large database. Whilst this provides flexibility it is not terribly efficient.  To greatly improve this situation, the MediaWiki engine saves the latest 'built' page in a cache and delivers that when a page is requested.
A MediaWiki caches pages for efficiency reasons.  The MediaWiki pages are created by parsing multiple tables within a large database. Whilst this provides flexibility it is not terribly efficient.  To greatly improve this situation, the MediaWiki engine saves the latest 'built' page in a cache and delivers that when a page is requested.
Line 32: Line 32:
</pre>
</pre>
==== Truncate database table l10n_cache ====
==== Truncate database table l10n_cache ====
From the [http://www.mediawiki.org/wiki/Manual:L10n_cache_table Mediawiki page covering this table].
From the [http://www.mediawiki.org/wiki/Manual:L10n_cache_table Mediawiki page covering this table]: ''"Its content can be deleted and excluded from backups as it will be regenerated when needed."''
Its content can be deleted and excluded from backups as it will be regenerated when needed.<ref>The l10n_cache table. Its content can be deleted and excluded from backups as it will be regenerated when needed.</ref>
 
This table can become massive. I've seen it as large as 5.4 gb on this server.
==See also==
==See also==
====Clear cache on edit/save of LocalSettings.php====
====Clear cache on edit/save of LocalSettings.php====
Line 41: Line 42:
$wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( __FILE__ ) ) );
$wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( __FILE__ ) ) );
</pre>
</pre>
====Clear cache of all pages (PurgeList.php)====
php  /var/www/vhosts/domain.com/httpdocs/wiki/maintenance/purgeList.php --purge --all
====Clear cache of a specific page (Perl)====
====Clear cache of a specific page (Perl)====
<pre>
<pre>
Line 64: Line 67:
}
}
</pre>
</pre>
 
* http://www.mediawiki.org/wiki/Manual:PurgeList.php
* http://meta.wikimedia.org/wiki/MediaWiki_FAQ#How_do_I_purge_cached_pages.3F
* http://meta.wikimedia.org/wiki/MediaWiki_FAQ#How_do_I_purge_cached_pages.3F
* http://www.mediawiki.org/wiki/Extension:MagicNoCache
* http://www.mediawiki.org/wiki/Extension:MagicNoCache
[[Category:Useful information]]
[[Category:Useful information]]
[[Category:Help]]
[[Category:Help]]
{{BottomBanner}}
<!-- footer hashtags --><code 'hashtagrev:12032020'>[[Special:Search/howtopreventmediawikicachingpages|#howtopreventmediawikicachingpages]] [[Special:Search/help|#help]] [[Special:Search/meatcookingtimecalculator|#meatcookingtimecalculator]]
</code><!-- /footer hashtags -->