Manual:$wgObjectCaches/pl

This page is a translated version of the page Manual:$wgObjectCaches and the translation is 12% complete.
Cache: $wgObjectCaches
Advanced object cache configuration.
Wprowadzono w wersji:1.18.0 (r83140)
Usunięto w wersji:nadal w użyciu
Dozwolone wartości:(array)
Domyślna wartość:patrz poniżej

Szczegóły

Advanced object cache configuration.

Use this to define the class names and constructor parameters which are used for the various cache types. Custom cache types may be defined here and referenced from $wgMainCacheType , $wgMessageCacheType or $wgParserCacheType .

The format is an associative array where the key is a cache identifier, and the value is an associative array of parameters. The "class" parameter is the class name which will be used. Alternatively, a "factory" parameter may be given, giving a callable function which will generate a suitable cache object.

Custom cache types

You can also create other cache configurations in addition to the built in CACHE_ constants by adding them. For example, to use redis as your cache (which does not have a built in CACHE_XXX constant) you can do:

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

The MediaWiki-Vagrant appliance runs a redis service and with this configuration.

Default value

The 'slaveOnly' option for SqlBagOStuff (przestarzałe od 1.34), was removed. Use 'replicaOnly' instead.

Wersja 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 ],
];
Wersje 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 ],
];
Wersje 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 ],
];
Wersja 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 ],
];
Wersje 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 ],
];
Wersje 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 ],
];
Wersja 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 ],
];
Wersja 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' ),
);
Wersje 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' ),
);
Wersje 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' ),
);
Wersja 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' ),
);
Wersja 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' ),
);