手册:$wgMainCacheType
缓存: $wgMainCacheType | |
---|---|
对象缓存设置 |
|
引进版本: | 1.5.0 |
移除版本: | 仍在使用 |
允许的值: | (One of the CACHE constants (see below), or a string indicating the cache type set as key in $wgObjectCaches ) |
默认值: | CACHE_NONE |
其他设置: 按首字母排序 | 按功能排序 |
细节
允许配置使用的对象缓存。
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
. 否则,请使用CACHE_DB
。CACHE_ACCEL
– 使用APCu或WinCache或OPcache(如果有)。CACHE_MEMCACHED
– Use memcached if available. Servers must additionally be specified in $wgMemCachedServers .CACHE_DB
– 使用数据库表objectcache 。
- 警告: 这可能比没有缓存要慢,即
CACHE_NONE
。
PHP works by compiling a PHP file into bytecode 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. Other supported op code caches are: WinCache.
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).
- It was stated that
CACHE_MEMCACHED
directive will provide the most significant performance improvements in the case where you have memcached and an opcode cache installed.
- This is just one of MediaWiki's caching settings.
- Since MediaWiki 1.27, PHP sessions are stored in a cache, depending on the variable of this setting, unless overridden by $wgSessionCacheType . This may cause problems when
CACHE_ACCEL
is used if apcu is misconfigured (see 任务T147161). CACHE_ACCEL
only supports APCu or WinCache since MediaWiki 1.31.