Cache: $wgMainCacheType | |
---|---|
Object cache setting | |
Introduced in version: | 1.5.0 |
Removed in version: | Still in use |
Allowed values: | (One of the CACHE constants (see below), or a string indicating the cache type set as key in$wgObjectCaches ) |
Default value: | CACHE_NONE |
Other settings:Alphabetical |By function |
Allows to configure the object cache used.
Here are the keys available by default (defined as constants in Defines.php):
CACHE_NONE
– Do not cache (default).CACHE_ANYTHING
– Use$wgMessageCacheType or$wgParserCacheType if they are set to something other thanCACHE_NONE
orCACHE_ANYTHING
. Otherwise useCACHE_DB
.CACHE_ACCEL
– UseAPCu or OPcache if available. (maintenance/install.php will add the line$wgMainCacheType = CACHE_ACCEL;
to your config.)CACHE_MEMCACHED
– Usememcached if available. Servers must additionally be specified in$wgMemCachedServers.CACHE_DB
– Use the database tableobjectcache.CACHE_NONE
.PHP works by compiling a PHP file intobytecode and then executing that bytecode.The process of compiling a large application such as MediaWiki takes considerable time.PHP accelerators work by storing the compiled bytecode and executing it directly reducing the time spent compiling code.
OPcache is included in PHP 5.5.0 and later and the recommended accelerator for MediaWiki.
Opcode caches store the compiled output of PHP scripts, greatly reducing the amount of time needed to run a script multiple times.MediaWiki does not need to be configured to do PHP bytecode caching and will "just work" once installed and enabled them.
See$wgObjectCaches for an example of a custom cache backend (e.g. Redis).
CACHE_MEMCACHED
directive will provide the most significantperformance improvements in the case where you have memcached and an opcode cache installed.CACHE_ACCEL
is used if apcu is misconfigured (seeT147161).