Příručka:$wgObjectCaches

This page is a translated version of the page Manual:$wgObjectCaches and the translation is 100% complete.
Mezipaměti: $wgObjectCaches
Pokročilá konfigurace mezipaměti objektů.
Zavedeno od verze:1.18.0 (r83140)
Odstraněno od verze:stále se používá
Povolené hodnoty:(pole)
Výchozí hodnota:viz níže

Podrobnosti

Pokročilá konfigurace mezipaměti objektů.

Použijte toto k definování názvů tříd a parametrů konstruktoru, které se používají pro různé typy mezipaměti. Zde lze definovat vlastní typy mezipaměti a odkazovat se na ně z $wgMainCacheType , $wgMessageCacheType nebo $wgParserCacheType .

Formát je asociativní pole, kde klíč je identifikátor mezipaměti a hodnota je asociativní pole parametrů. Parametr "class" je název třídy, který bude použit. Alternativně může být dán parametr "tovární", poskytující volatelnou funkci, která vygeneruje vhodný objekt mezipaměti.

Vlastní typy mezipaměti

Kromě vestavěných konstant CACHE_ můžete také vytvořit další konfigurace mezipaměti jejich přidáním. Chcete-li například použít redis jako mezipaměť (která nemá vestavěnou konstantu CACHE_XXX), můžete:

$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';

Zařízení MediaWiki-Vagrant spouští službu redis s touto konfigurací.

Výchozí hodnota

The 'slaveOnly' option for SqlBagOStuff (zastaralé od 1.34), was removed. Use 'replicaOnly' instead.

Verze MediaWiki:
1.42
$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 ],
];
Verze MediaWiki:
1.38 – 1.41
$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 ],
];
Verze MediaWiki:
1.35 – 1.37
$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 ],
];
Verze MediaWiki:
1.34
$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' => [
			'class' => SqlBagOStuff::class,
			'args'  => [ [ 'replicaOnly' => true ] ]
		],
		'writeFactory' => [
			'class' => SqlBagOStuff::class,
			'args'  => [ [ 'replicaOnly' => false ] ]
		],
		'loggroup'  => 'SQLBagOStuff',
		'reportDupes' => false
	],

	'apc' => [ 'class' => APCBagOStuff::class, 'reportDupes' => false ],
	'apcu' => [ 'class' => APCUBagOStuff::class, 'reportDupes' => false ],
	'wincache' => [ 'class' => WinCacheBagOStuff::class, 'reportDupes' => false ],
	'memcached-php' => [ 'class' => MemcachedPhpBagOStuff::class, 'loggroup' => 'memcached' ],
	'memcached-pecl' => [ 'class' => MemcachedPeclBagOStuff::class, 'loggroup' => 'memcached' ],
	'hash' => [ 'class' => HashBagOStuff::class, 'reportDupes' => false ],
];
Verze MediaWiki:
1.31 – 1.33
$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' => [
			'class' => SqlBagOStuff::class,
			'args'  => [ [ 'slaveOnly' => true ] ]
		],
		'writeFactory' => [
			'class' => SqlBagOStuff::class,
			'args'  => [ [ 'slaveOnly' => false ] ]
		],
		'loggroup'  => 'SQLBagOStuff',
		'reportDupes' => false
	],

	'apc' => [ 'class' => APCBagOStuff::class, 'reportDupes' => false ],
	'apcu' => [ 'class' => APCUBagOStuff::class, 'reportDupes' => false ],
	'wincache' => [ 'class' => WinCacheBagOStuff::class, 'reportDupes' => false ],
	'memcached-php' => [ 'class' => MemcachedPhpBagOStuff::class, 'loggroup' => 'memcached' ],
	'memcached-pecl' => [ 'class' => MemcachedPeclBagOStuff::class, 'loggroup' => 'memcached' ],
	'hash' => [ 'class' => HashBagOStuff::class, 'reportDupes' => false ],
];
Verze MediaWiki:
1.28 – 1.30
$wgObjectCaches = [
	CACHE_NONE => [ 'class' => 'EmptyBagOStuff', 'reportDupes' => false ],
	CACHE_DB => [ 'class' => 'SqlBagOStuff', 'loggroup' => 'SQLBagOStuff' ],

	CACHE_ANYTHING => [ 'factory' => 'ObjectCache::newAnything' ],
	CACHE_ACCEL => [ 'factory' => 'ObjectCache::getLocalServerInstance' ],
	CACHE_MEMCACHED => [ 'class' => 'MemcachedPhpBagOStuff', 'loggroup' => 'memcached' ],

	'db-replicated' => [
		'class'       => 'ReplicatedBagOStuff',
		'readFactory' => [
			'class' => 'SqlBagOStuff',
			'args'  => [ [ 'slaveOnly' => true ] ]
		],
		'writeFactory' => [
			'class' => 'SqlBagOStuff',
			'args'  => [ [ 'slaveOnly' => false ] ]
		],
		'loggroup'  => 'SQLBagOStuff',
		'reportDupes' => false
	],

	'apc' => [ 'class' => 'APCBagOStuff', 'reportDupes' => false ],
	'apcu' => [ 'class' => 'APCUBagOStuff', 'reportDupes' => false ],
	'xcache' => [ 'class' => 'XCacheBagOStuff', 'reportDupes' => false ],
	'wincache' => [ 'class' => 'WinCacheBagOStuff', 'reportDupes' => false ],
	'memcached-php' => [ 'class' => 'MemcachedPhpBagOStuff', 'loggroup' => 'memcached' ],
	'memcached-pecl' => [ 'class' => 'MemcachedPeclBagOStuff', 'loggroup' => 'memcached' ],
	'hash' => [ 'class' => 'HashBagOStuff', 'reportDupes' => false ],
];
Verze MediaWiki:
1.27
$wgObjectCaches = [
	CACHE_NONE => [ 'class' => 'EmptyBagOStuff', 'reportDupes' => false ],
	CACHE_DB => [ 'class' => 'SqlBagOStuff', 'loggroup' => 'SQLBagOStuff' ],

	CACHE_ANYTHING => [ 'factory' => 'ObjectCache::newAnything' ],
	CACHE_ACCEL => [ 'factory' => 'ObjectCache::getLocalServerInstance' ],
	CACHE_MEMCACHED => [ 'class' => 'MemcachedPhpBagOStuff', 'loggroup' => 'memcached' ],

	'db-replicated' => [
		'class'       => 'ReplicatedBagOStuff',
		'readFactory' => [
			'class' => 'SqlBagOStuff',
			'args'  => [ [ 'slaveOnly' => true ] ]
		],
		'writeFactory' => [
			'class' => 'SqlBagOStuff',
			'args'  => [ [ 'slaveOnly' => false ] ]
		],
		'loggroup'  => 'SQLBagOStuff'
	],

	'apc' => [ 'class' => 'APCBagOStuff', 'reportDupes' => false ],
	'apcu' => [ 'class' => 'APCUBagOStuff', 'reportDupes' => false ],
	'xcache' => [ 'class' => 'XCacheBagOStuff', 'reportDupes' => false ],
	'wincache' => [ 'class' => 'WinCacheBagOStuff', 'reportDupes' => false ],
	'memcached-php' => [ 'class' => 'MemcachedPhpBagOStuff', 'loggroup' => 'memcached' ],
	'memcached-pecl' => [ 'class' => 'MemcachedPeclBagOStuff', 'loggroup' => 'memcached' ],
	'hash' => [ 'class' => 'HashBagOStuff', 'reportDupes' => false ],
];
Verze MediaWiki:
1.26
$wgObjectCaches = array(
	CACHE_NONE => array( 'class' => 'EmptyBagOStuff' ),
	CACHE_DB => array( 'class' => 'SqlBagOStuff', 'loggroup' => 'SQLBagOStuff' ),

	CACHE_ANYTHING => array( 'factory' => 'ObjectCache::newAnything' ),
	CACHE_ACCEL => array( 'factory' => 'ObjectCache::newAccelerator' ),
	CACHE_MEMCACHED => array( 'factory' => 'ObjectCache::newMemcached', 'loggroup' => 'memcached' ),

	'db-replicated' => array(
		'class'       => 'ReplicatedBagOStuff',
		'readFactory' => array(
			'class' => 'SqlBagOStuff',
			'args'  => array( array( 'slaveOnly' => true ) )
		),
		'writeFactory' => array(
			'class' => 'SqlBagOStuff',
			'args'  => array( array( 'slaveOnly' => false ) )
		),
		'loggroup'  => 'SQLBagOStuff'
	),

	'apc' => array( 'class' => 'APCBagOStuff' ),
	'xcache' => array( 'class' => 'XCacheBagOStuff' ),
	'wincache' => array( 'class' => 'WinCacheBagOStuff' ),
	'memcached-php' => array( 'class' => 'MemcachedPhpBagOStuff', 'loggroup' => 'memcached' ),
	'memcached-pecl' => array( 'class' => 'MemcachedPeclBagOStuff', 'loggroup' => 'memcached' ),
	'hash' => array( 'class' => 'HashBagOStuff' ),
);
Verze MediaWiki:
1.23 – 1.25
$wgObjectCaches = array(
   CACHE_NONE => array( 'class' => 'EmptyBagOStuff' ),
   CACHE_DB => array( 'class' => 'SqlBagOStuff', 'table' => 'objectcache' ),
 
   CACHE_ANYTHING => array( 'factory' => 'ObjectCache::newAnything' ),
   CACHE_ACCEL => array( 'factory' => 'ObjectCache::newAccelerator' ),
   CACHE_MEMCACHED => array( 'factory' => 'ObjectCache::newMemcached' ),
 
   'apc' => array( 'class' => 'APCBagOStuff' ),
   'xcache' => array( 'class' => 'XCacheBagOStuff' ),
   'wincache' => array( 'class' => 'WinCacheBagOStuff' ),
   'memcached-php' => array( 'class' => 'MemcachedPhpBagOStuff' ),
   'memcached-pecl' => array( 'class' => 'MemcachedPeclBagOStuff' ),
   'hash' => array( 'class' => 'HashBagOStuff' ),
);
Verze MediaWiki:
1.20 – 1.22
$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_ACCEL => array( 'factory' => 'ObjectCache::newAccelerator' ),
   CACHE_MEMCACHED => array( 'factory' => 'ObjectCache::newMemcached' ),
 
   'apc' => array( 'class' => 'APCBagOStuff' ),
   'xcache' => array( 'class' => 'XCacheBagOStuff' ),
   'wincache' => array( 'class' => 'WinCacheBagOStuff' ),
   'memcached-php' => array( 'class' => 'MemcachedPhpBagOStuff' ),
   'memcached-pecl' => array( 'class' => 'MemcachedPeclBagOStuff' ),
   'hash' => array( 'class' => 'HashBagOStuff' ),
);
Verze MediaWiki:
1.19
$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_ACCEL => array( 'factory' => 'ObjectCache::newAccelerator' ),
   CACHE_MEMCACHED => array( 'factory' => 'ObjectCache::newMemcached' ),
 
   'apc' => array( 'class' => 'APCBagOStuff' ),
   'xcache' => array( 'class' => 'XCacheBagOStuff' ),
   'wincache' => array( 'class' => 'WinCacheBagOStuff' ),
   'memcached-php' => array( 'class' => 'MemcachedPhpBagOStuff' ),
   'hash' => array( 'class' => 'HashBagOStuff' ),
);
Verze MediaWiki:
1.18
$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_ACCEL => array( 'factory' => 'ObjectCache::newAccelerator' ),
   CACHE_MEMCACHED => array( 'factory' => 'ObjectCache::newMemcached' ),

   'eaccelerator' => array( 'class' => 'eAccelBagOStuff' ),
   'apc' => array( 'class' => 'APCBagOStuff' ),
   'xcache' => array( 'class' => 'XCacheBagOStuff' ),
   'wincache' => array( 'class' => 'WinCacheBagOStuff' ),
   'memcached-php' => array( 'class' => 'MemcachedPhpBagOStuff' ),
   'hash' => array( 'class' => 'HashBagOStuff' ),
);