From: Ori Livneh Date: Fri, 9 Oct 2015 23:26:26 +0000 (-0700) Subject: Add ObjectCache::getMainClusterInstance() X-Git-Tag: 1.31.0-rc.0~9455^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/bilan.php?a=commitdiff_plain;h=b739bf5a74b6017ed45351dc72f28522cd7af859;p=lhc%2Fweb%2Fwiklou.git Add ObjectCache::getMainClusterInstance() Provide a complement to ObjectCache::getMainWANInstance() and ObjectCache::getMainStashInstance() which gets the default ObjectCache instance. Change-Id: Ib16ee40908b159e60be41a308db49a9291b5de0d --- diff --git a/includes/objectcache/ObjectCache.php b/includes/objectcache/ObjectCache.php index 70e97ff148..c40f69613f 100644 --- a/includes/objectcache/ObjectCache.php +++ b/includes/objectcache/ObjectCache.php @@ -47,7 +47,7 @@ use MediaWiki\Logger\LoggerFactory; * Stored only on the individual web server. * Not associated with other servers. * - * - wfGetMainCache() + * - ObjectCache::getMainClusterInstance() * Purpose: Cache. * Stored centrally within the local data-center. * Not replicated to other DCs. @@ -261,6 +261,18 @@ class ObjectCache { return new $class( $params ); } + /** + * Get the main cluster-local cache object. + * + * @since 1.27 + * @return BagOStuff + */ + public static function getMainClusterInstance() { + $config = RequestContext::getMain()->getConfig(); + $id = $config->get( 'MainCacheType' ); + return self::getInstance( $id ); + } + /** * Get the main WAN cache object. *