帮助:MediaWiki/设置/缓存

来自GIPRs
跳转至: 导航搜索
项目文档
项目主页 GIPRs语义维基
文档类型 日志
优先级
状 态 进行中
发布日期 2013/03/13
完成日期
作 者 GIPRs语义维基项目团队
来 源 www.giprs.org
源语言 中文

为方便查看和记录,参考并直接引用:http://www.mediawiki.org/wiki/Manual:Configuration_settings

目录

Cache

主要文档:http://www.mediawiki.org/wiki/Manual:Cache#On_a_single_server

// 启用,取默认值“false”

  • $wgCacheEpoch - Set this to current time to invalidate all prior cached pages.

// DefaultSettings.php:“20030516000000”
// LocalSettings.php:未设置,等同于使用默认值

  • $wgCachePrefix - Overwrite the caching key prefix with custom value.

// DefaultSettings.php:“false”
// LocalSettings.php:取默认值

  • $wgCheckSerialized {{deprecated-inline|1.16}} - Check if serialised files are up to date.

// 弃用

// 启用,暂取默认值5

// 待处理

// DefaultSettings.php:“true”
// LocalSettings.php:取默认值

// DefaultSettings.php:“CACHE_ANYTHING”
// LocalSettings.php:取默认值

// DefaultSettings.php:“CACHE_NONE”
// LocalSettings.php:“CACHE_ANYTHING”

// 参考范例已作设置

// DefaultSettings.php:“3600”
// LocalSettings.php:未设置,等同于使用默认值

  • $wgQueryCacheLimit - Number of rows to cache in 'querycache' table when miser mode is on.

// DefaultSettings.php:“1000”
// LocalSettings.php:暂时取默认值

// DefaultSettings.php:“1000”
// LocalSettings.php:取值参照:http://www.mediawiki.org/wiki/User:Aaron_Schulz/How_to_make_MediaWiki_fast

  • $wgThumbnailEpoch - If rendered thumbnail files are older than this timestamp, they will be rerendered on demand as if the file didn't already exist.

//弃用

  • $wgUseETag - Whether MediaWiki should send an ETag header.

// bug 7098,弃用

// DefaultSettings.php:“false”
// LocalSettings.php:“true”

// DefaultSettings.php:“100”
// LocalSettings.php:暂时取默认值

  • $wgSessionsInMemcached {{deprecated-inline|1.20}} - Store session data in the object cache, rather than on the filesystem.

//弃用

// DefaultSettings.php:“CACHE_ANYTHING”
// LocalSettings.php:取默认值

// DefaultSettings.php:“false”
// LocalSettings.php:“true”


2013.02.22:

$wgMainCacheType = CACHE_ANYTHING; // Use anything, as long as it works
$wgCacheDirectory   = false;
$wgMemCachedServers = array( '127.0.0.1:11211' ); //测试
$wgCachePrefix = false;
$wgClockSkewFudge = 5;
$wgInvalidateCacheOnLocalSettingsChange = true;
$wgLanguageConverterCacheType  = CACHE_ANYTHING;
$wgObjectCaches = array(
       CACHE_NONE => array( 'class' => 'EmptyBagOStuff' ),
       CACHE_DB => array( 'class' => 'SqlBagOStuff', 'table' => 'objectcache' ),
       CACHE_DBA => array( 'class' => 'DBABagOStuff' ),
       CACHE_ANYTHING => array( 'factory' => 'ObjectCache::newAnything' ),
       CACHE_MEMCACHED => array( 'factory' => 'ObjectCache::newMemcached' ),
       'apc' => array( 'class' => 'APCBagOStuff' ),
       'memcached-php' => array( 'class' => 'MemcachedPhpBagOStuff' ),
       'hash' => array( 'class' => 'HashBagOStuff' ),
);
$wgRevisionCacheExpiry = 3*24*3600;
$wgQueryCacheLimit = 1000;
$wgUseGzip = true;
$wgUpdateRowsPerQuery = 100;
$wgSessionsInObjectCache = true;
$wgSessionCacheType = CACHE_ANYTHING;

Client side caching

* $wgCachePages - Allow client-side caching of pages

用户可在系统设置中自行设置是否启用页面设置,可忽略该项;建议用户均设置为启用。

File Cache

Setting for Server side file caching

* $wgFileCacheDepth - Depth of the subdirectory hierarchy to be created under $wgFileCacheDirectory. // mw:Manual:$wgFileCacheDepth
* $wgFileCacheDirectory - Directory where the cached page will be saved when using server-side caching.
* $wgUseFileCache - This will cache static pages for non-logged-in users to reduce database traffic on public sites.

参照mw:Manual:File cache设置,确定以下设置:

$wgUseFileCache = true; /* default: false */
$wgFileCacheDirectory = "$IP/cache";

“$wgShowIPinHeader = false;”,不需要设置(设置后反而会出错);参见:mw:Manual:$wgShowIPinHeader “Note: If $wgUseFileCache is enabled, $wgShowIPinHeader is automatically set to false.”

Message Cache

  • $wgAdaptiveMessageCache - Instead of caching everything, keep track which messages are requested and load only most used messages.

// DefaultSettings.php:“false”
// LocalSettings.php:“true”

  • $wgEnableSerializedMessages {{deprecated-inline|1.16}} - Whether serialized versions of the messages arrays will be read from the 'serialized' subdirectory if they are present.

//弃用

//待处理

  • $wgLocalMessageCache {{deprecated-inline|1.16}} - Directory for local copy of message cache, for use in addition to memcached.

//弃用

// DefaultSettings.php:“true”
// LocalSettings.php:取默认值

// DefaultSettings.php:“10000”
// LocalSettings.php:暂时取默认值

// DefaultSettings.php:“CACHE_ANYTHING”
// LocalSettings.php:暂时取默认值

// DefaultSettings.php:“false”
// LocalSettings.php:未设置


2013.02.23:

$wgAdaptiveMessageCache = true;
$wgLocalMessageCacheSerialized = true;
$wgMaxMsgCacheEntrySize = 10000;
$wgMessageCacheType = CACHE_ANYTHING;

Sidebar Cache

* $wgEnableSidebarCache - If true, cache the sidebar navigation links.
* $wgSidebarCacheExpiry - Expiry time for the sidebar cache.

仅设置:“$wgEnableSidebarCache = true;”,因为:Expiry time for the sidebar cache, in seconds (default: 1 day), has no effect if $wgEnableSidebarCache is off (default).

Parser Cache

  • $wgEnableParserCache - Keep parsed pages in a cache (objectcache table, turck, or memcached) to speed up output of the same page viewed by another user with the same options.

// DefaultSettings.php:“true”
// LocalSettings.php:取默认值

  • $wgRenderHashAppend - Append a configured value to the parser cache and the sitenotice cache keys.

// 默认值留空,待处理

// DefaultSettings.php:“86400”(默认为24小时?)
// LocalSettings.php:取值参照:http://www.mediawiki.org/wiki/User:Aaron_Schulz/How_to_make_MediaWiki_fast

// DefaultSettings.php:“CACHE_ANYTHING”
// LocalSettings.php:取默认值


2013.02.23:

$wgEnableParserCache = true;
$wgParserCacheType = CACHE_MEMCACHED;
$wgParserCacheExpireTime = 14*24*3600;

Memcached settings

Settings for configuring the mw:Memcached memory-based object store (if you are using it) docs/memcached.txt has more details.

  • $wgUseMemCached {{deprecated-inline|1.17}} - Use memcache, using the servers set in $wgMemCachedServers.
  • $wgLinkCacheMemcached {{deprecated-inline|1.13}} - Cache links using object cache setting (memcache, Turck MMCache, eAccelerator, etc.)
  • $wgMemCachedDebug - Will be set to false in Setup.php, if the server isn't working. // Default value:false:不设置
2个不考虑,3个有默认值,只需设置$wgMemCachedServers:IP地址和端口

Interwiki cache

See mw:interwiki cache for more information.

MW主要使用CDB来缓存,不熟只能用memcached,但都报错,带处理。

小结

其他参考文档:

$wgMiserMode

备注