A változóval az objektum-gyorsítótár további konfigurációja lehetséges.
Használata a különböző gyorsítótár-típusokhoz alkalmazott osztálynevek és konstruktor-paraméterek definiálásával lehetséges.
Az egyedi gyorsítótár-típusokat itt lehet megadni; a $wgMainCacheType, a $wgMessageCacheType vagy a $wgParserCacheType hivatkoznak rájuk.
A formátum egy asszociatív tömb, ahol a kulcs a gyorsítótár azonosítója, az érték pedig a paraméterek asszociatív tömbje.
A „class” paraméter a használandó osztálynév;
alternatívaként a „factory” paraméter is használható, amely egy megfelelő gyorsítótár-objektumot létrehozó meghívható funkciót definiál.
Egyedi gyorsítótár-típusok
A CACHE_-konstansokon felül további gyorsítótárakat is megadhatsz.
Például, ha a gyorsítótárhoz a Redist szeretnéd használni (amelyhez nem tartozik CACHE_XXX-konstans), a következő kóddal teheted meg:
$wgObjectCaches['redis']=['class'=>'RedisBagOStuff','servers'=>['127.0.0.1:6379'],'password'=>'Your-Redis-password',// Highly recommended, otherwise comment out this line.'persistent'=>true,];$wgMainCacheType='redis';
A MediaWiki-Vagrant ezzel a konfigurációval egy Redis-szolgáltatást futtat.
Alapértelmezett érték
The 'slaveOnly' option for SqlBagOStuff <translate> (deprecated in <tvar name=2>1.34</tvar>)</translate>, was removed. Use 'replicaOnly' instead.
<td class="mw-version-versionbox" title="<translate nowrap> The latest stable version is <tvar name=1>1.41</tvar></translate>">
<translate> ≥</translate> 1.42
<translate> MediaWiki version:</translate>
$wgObjectCaches=[CACHE_NONE=>['class'=>EmptyBagOStuff::class,'reportDupes'=>false],CACHE_DB=>['class'=>SqlBagOStuff::class,'loggroup'=>'SQLBagOStuff'],'memcached-php'=>['class'=>MemcachedPhpBagOStuff::class,'loggroup'=>'memcached'],'memcached-pecl'=>['class'=>MemcachedPeclBagOStuff::class,'loggroup'=>'memcached'],'hash'=>['class'=>HashBagOStuff::class,'reportDupes'=>false],// Deprecated since 1.35.// - To configure a wg*CacheType variable to use the local server cache,// use CACHE_ACCEL instead, which will select these automatically.// - To access the object for the local server cache at run-time,// use MediaWikiServices::getLocalServerObjectCache()// instead of e.g. ObjectCache::getInstance( 'apcu' ).// - To instantiate a new one of these explicitly, do so directly// by using `new APCUBagOStuff( [ … ] )`// - To instantiate a new one of these including auto-detection and fallback,// use ObjectCache::makeLocalServerCache().'apc'=>['class'=>APCUBagOStuff::class,'reportDupes'=>false],'apcu'=>['class'=>APCUBagOStuff::class,'reportDupes'=>false],'wincache'=>['class'=>WinCacheBagOStuff::class,'reportDupes'=>false],];
<td class="mw-version-versionbox" title="<translate nowrap> MediaWiki <tvar name=1>1.41</tvar> is stable version</translate>">
1.38 – 1.41
<translate> MediaWiki versions:</translate>
$wgObjectCaches=[CACHE_NONE=>['class'=>EmptyBagOStuff::class,'reportDupes'=>false],CACHE_DB=>['class'=>SqlBagOStuff::class,'loggroup'=>'SQLBagOStuff'],CACHE_ANYTHING=>['factory'=>'ObjectCache::newAnything'],CACHE_ACCEL=>['factory'=>'ObjectCache::getLocalServerInstance'],'db-replicated'=>['class'=>ReplicatedBagOStuff::class,'readFactory'=>['factory'=>'ObjectCache::newFromParams','args'=>[['class'=>SqlBagOStuff::class,'replicaOnly'=>true]]],'writeFactory'=>['factory'=>'ObjectCache::newFromParams','args'=>[['class'=>SqlBagOStuff::class,'replicaOnly'=>false]]],'loggroup'=>'SQLBagOStuff','reportDupes'=>false],'memcached-php'=>['class'=>MemcachedPhpBagOStuff::class,'loggroup'=>'memcached'],'memcached-pecl'=>['class'=>MemcachedPeclBagOStuff::class,'loggroup'=>'memcached'],'hash'=>['class'=>HashBagOStuff::class,'reportDupes'=>false],// Deprecated since 1.35.// - To configure a wg*CacheType variable to use the local server cache,// use CACHE_ACCEL instead, which will select these automatically.// - To access the object for the local server cache at run-time,// use MediaWikiServices::getLocalServerObjectCache()// instead of e.g. ObjectCache::getInstance( 'apcu' ).// - To instantiate a new one of these explicitly, do so directly// by using `new APCUBagOStuff( [ … ] )`// - To instantiate a new one of these including auto-detection and fallback,// use ObjectCache::makeLocalServerCache().'apc'=>['class'=>APCUBagOStuff::class,'reportDupes'=>false],'apcu'=>['class'=>APCUBagOStuff::class,'reportDupes'=>false],'wincache'=>['class'=>WinCacheBagOStuff::class,'reportDupes'=>false],];
<td class="mw-version-versionbox" title="<translate nowrap> MediaWiki <tvar name=1>1.37</tvar> is unsupported version</translate>">
1.35 – 1.37
<translate> MediaWiki versions:</translate>
$wgObjectCaches=[CACHE_NONE=>['class'=>EmptyBagOStuff::class,'reportDupes'=>false],CACHE_DB=>['class'=>SqlBagOStuff::class,'loggroup'=>'SQLBagOStuff'],CACHE_ANYTHING=>['factory'=>'ObjectCache::newAnything'],CACHE_ACCEL=>['factory'=>'ObjectCache::getLocalServerInstance'],CACHE_MEMCACHED=>['class'=>MemcachedPhpBagOStuff::class,'loggroup'=>'memcached'],'db-replicated'=>['class'=>ReplicatedBagOStuff::class,'readFactory'=>['factory'=>'ObjectCache::newFromParams','args'=>[['class'=>SqlBagOStuff::class,'replicaOnly'=>true]]],'writeFactory'=>['factory'=>'ObjectCache::newFromParams','args'=>[['class'=>SqlBagOStuff::class,'replicaOnly'=>false]]],'loggroup'=>'SQLBagOStuff','reportDupes'=>false],'memcached-php'=>['class'=>MemcachedPhpBagOStuff::class,'loggroup'=>'memcached'],'memcached-pecl'=>['class'=>MemcachedPeclBagOStuff::class,'loggroup'=>'memcached'],'hash'=>['class'=>HashBagOStuff::class,'reportDupes'=>false],// Deprecated since 1.35.// - To configure a wg*CacheType variable to use the local server cache,// use CACHE_ACCEL instead, which will select these automatically.// - To access the object for the local server cache at run-time,// use MediaWikiServices::getLocalServerObjectCache()// instead of e.g. ObjectCache::getInstance( 'apcu' ).// - To instantiate a new one of these explicitly, do so directly// by using `new APCUBagOStuff( [ … ] )`// - To instantiate a new one of these including auto-detection and fallback,// use ObjectCache::makeLocalServerCache().'apc'=>['class'=>APCUBagOStuff::class,'reportDupes'=>false],'apcu'=>['class'=>APCUBagOStuff::class,'reportDupes'=>false],'wincache'=>['class'=>WinCacheBagOStuff::class,'reportDupes'=>false],];
<td class="mw-version-versionbox" title="<translate nowrap> MediaWiki <tvar name=1>1.34</tvar> is unsupported version</translate>">