- $allInfo = static::fetchTitleInfo( $db, array_keys( $allPages ), __METHOD__ );
- foreach ( $wikiModules as $module ) {
- $pages = $module->getPages( $context );
+
+ $allPageNames = array_keys( $allPages );
+ sort( $allPageNames );
+ $hash = sha1( implode( '|', $allPageNames ) );
+
+ // Avoid Zend bug where "static::" does not apply LSB in the closure
+ $func = [ static::class, 'fetchTitleInfo' ];
+
+ $cache = ObjectCache::getMainWANInstance();
+ $allInfo = $cache->getWithSetCallback(
+ $cache->makeGlobalKey( 'resourceloader', 'titleinfo', $db->getWikiID(), $hash ),
+ $cache::TTL_HOUR,
+ function ( $curValue, &$ttl, array &$setOpts ) use ( $func, $allPageNames, $db ) {
+ $setOpts += Database::getCacheSetOptions( $db );
+
+ return call_user_func( $func, $db, $allPageNames, __METHOD__ );
+ },
+ [ 'checkKeys' => [ $cache->makeGlobalKey( 'resourceloader', 'titleinfo', $db->getWikiID() ) ] ]
+ );
+
+ foreach ( $wikiModules as $wikiModule ) {
+ $pages = $wikiModule->getPages( $context );