Help:File cache

From GRWiktionaryHelp

MediaWiki Handbook: Contents | How To Use Help | Other help Software help for MediaWikiReaders, Editors, Admins e0 +/-


Mediawiki supports a basic file cache for static pages for non-logged-in visitors. When an anonymous user requests a page it is constructed from the database, and also stored in the cache. When the same page is requested later on, it is directly served from the cache, without the need to query the database. This will reduce the database and server load on public sites.

Enabling the cache

The file cache is enabled by setting these variables in LocalSettings.php:

$wgUseFileCache = true;
$wgFileCacheDirectory = "/tmp/yourcache";
$wgShowIPinHeader = false;
$wgUseGzip = false;

Setting $wgShowIPinHeader to false is required. Since the cache serves the same page to many visitors, it's not possible to include the unique IP number of the current visitor in the page.

Setting $wgUseGzip to false is currently (1.3.0beta6) required to workaround a bug. This implies that files are cached and sent over the wire uncompressed (saves CPU cycles, at the cost of bandwith).

You need to manually create the top level cache directory and make sure Mediawiki can write to it:

mkdir -p /tmp/yourcache
chmod 777 /tmp/yourcache -R

Mediawiki will automatically create a two-level directory structure in the cache directory, to improve performance of file retrieval from the cache.

You can see that the cache works by repeatedly refreshing a page with a visitor counter. Even with a forced reload (Ctrl-Shift-Refresh in Internet Explorer) the counter will not increment.

Limitations

  • It's not possible to limit or manage the size of the cache.
  • Dynamic elements of a page (such as the visitor counter) will not be refreshed.
  • Only a part of the traffic is cached. Logged-in users, special pages etc. are not cached.
MediaWiki Handbook: Contents | Other help


Reading: Go | Search | URL | Namespace | Page name | Section | Link | Backlinks | Piped link | Interwiki link | Redirect | Variable | Category | Special page
Tracking changes: Recent | (enhanced) | Related | Watching pages | Page history | Diff | User contributions | Edit summary | Minor edit |
Logging in and preferences: Logging in | Preferences | User style
Editing: Overview | Wikitext | New page | List | Images/files | Image page | Special characters | Formula | Table | EasyTimeline | Template | Renaming / Moving a page | Editing shortcuts | Talk page | Testing | Export |

Wiki Projects: Wikibooks | Wikicommons | Wikipedia | Wikiquote | Wikisource | Wiktionary |