Jump to content

Kézikönyv:$wgObjectCaches

From mediawiki.org
This page is a translated version of the page Manual:$wgObjectCaches and the translation is 94% complete.
Outdated translations are marked like this.
Cache: $wgObjectCaches
Haladó objektumgyorsítótár-konfiguráció.
Bevezetve:1.18.0 (r83140)
Eltávolítva:használatban
Megengedett értékek:(tömb)
Alapértelmezett érték:lásd alább

Részletek

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 (elavultnak jelölve 1.34), was removed. Use 'replicaOnly' instead.

MediaWiki-verzió:
1.43
$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 ],
];
MediaWiki-verzió:
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 ],
];
MediaWiki-verziók:
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 ],
];
MediaWiki-verziók:
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 ],
];
MediaWiki-verzió:
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 ],
];
MediaWiki-verziók:
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 ],
];
MediaWiki-verziók:
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 ],
];
MediaWiki-verzió:
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 ],
];
MediaWiki-verzió:
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' ),
);
MediaWiki-verziók:
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' ),
);
MediaWiki-verziók:
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' ),
);
MediaWiki-verzió:
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' ),
);
MediaWiki-verzió:
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' ),
);