Merge "Followup a88df43d: make $wgDebugDumpSql log commented queries again"
[lhc/web/wiklou.git] / includes / cache / BacklinkCache.php
index 3ba4f61..c04a22a 100644 (file)
@@ -40,8 +40,8 @@
  * Introduced by r47317
  */
 class BacklinkCache {
-       /** @var ProcessCacheLRU */
-       protected static $cache;
+       /** @var BacklinkCache */
+       protected static $instance;
 
        /**
         * Multi dimensions array representing batches. Keys are:
@@ -53,6 +53,7 @@ class BacklinkCache {
         * @see BacklinkCache::partitionResult()
         *
         * Cleared with BacklinkCache::clear()
+        * @var array[]
         */
        protected $partitionCache = array();
 
@@ -62,6 +63,7 @@ class BacklinkCache {
         *
         * Initialized with BacklinkCache::getLinks()
         * Cleared with BacklinkCache::clear()
+        * @var ResultWrapper[]
         */
        protected $fullResultCache = array();
 
@@ -99,15 +101,10 @@ class BacklinkCache {
         * @return BacklinkCache
         */
        public static function get( Title $title ) {
-               if ( !self::$cache ) { // init cache
-                       self::$cache = new ProcessCacheLRU( 1 );
+               if ( !self::$instance || !self::$instance->title->equals( $title ) ) {
+                       self::$instance = new self( $title );
                }
-               $dbKey = $title->getPrefixedDBkey();
-               if ( !self::$cache->has( $dbKey, 'obj', 3600 ) ) {
-                       self::$cache->set( $dbKey, 'obj', new self( $title ) );
-               }
-
-               return self::$cache->get( $dbKey, 'obj' );
+               return self::$instance;
        }
 
        /**