Merge "Document return of void in Maintenance::execute"
[lhc/web/wiklou.git] / includes / cache / LinkCache.php
index 23cc26d..7cbb86f 100644 (file)
@@ -20,6 +20,9 @@
  * @file
  * @ingroup Cache
  */
+
+use Wikimedia\Rdbms\Database;
+use Wikimedia\Rdbms\IDatabase;
 use MediaWiki\Linker\LinkTarget;
 use MediaWiki\MediaWikiServices;
 
@@ -278,6 +281,20 @@ class LinkCache {
                return $id;
        }
 
+       /**
+        * @param WANObjectCache $cache
+        * @param TitleValue $t
+        * @return string[]
+        * @since 1.28
+        */
+       public function getMutableCacheKeys( WANObjectCache $cache, TitleValue $t ) {
+               if ( $this->isCacheable( $t ) ) {
+                       return [ $cache->makeKey( 'page', $t->getNamespace(), sha1( $t->getDBkey() ) ) ];
+               }
+
+               return [];
+       }
+
        private function isCacheable( LinkTarget $title ) {
                return ( $title->inNamespace( NS_TEMPLATE ) || $title->inNamespace( NS_FILE ) );
        }
@@ -304,7 +321,7 @@ class LinkCache {
         */
        public function invalidateTitle( LinkTarget $title ) {
                if ( $this->isCacheable( $title ) ) {
-                       $cache = ObjectCache::getMainWANInstance();
+                       $cache = $this->wanCache;
                        $cache->delete(
                                $cache->makeKey( 'page', $title->getNamespace(), sha1( $title->getDBkey() ) )
                        );