Added ObjectCache::getMainWANInstance() helper method
authorAaron Schulz <aschulz@wikimedia.org>
Mon, 27 Apr 2015 21:23:32 +0000 (14:23 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Mon, 27 Apr 2015 21:28:43 +0000 (14:28 -0700)
Change-Id: I3d8d93b3bb6f7e06fae7adc694e6d4d851b2d8c2

includes/objectcache/ObjectCache.php

index 301336f..5da22f0 100644 (file)
@@ -57,6 +57,7 @@ class ObjectCache {
         * @param string $id
         *
         * @return WANObjectCache
+        * @since 1.26
         */
        static function getWANInstance( $id ) {
                if ( isset( self::$wanInstances[$id] ) ) {
@@ -196,6 +197,7 @@ class ObjectCache {
         *
         * @throws MWException
         * @return WANObjectCache
+        * @since 1.26
         */
        static function newWANCacheFromId( $id ) {
                global $wgWANObjectCaches;
@@ -213,4 +215,16 @@ class ObjectCache {
 
                return new $class( $params );
        }
+
+       /**
+        * Get the main WAN cache object
+        *
+        * @return WANObjectCache
+        * @since 1.26
+        */
+       static function getMainWANInstance() {
+               global $wgMainWANCache;
+
+               return self::getWANInstance( $wgMainWANCache );
+       }
 }