- if ( !isset( $this->mQueryCache[$url] ) ) {
- $data = ObjectCache::getMainWANInstance()->getWithSetCallback(
- $this->getLocalCacheKey( get_class( $this ), $target, md5( $url ) ),
- $cacheTTL,
- function () use ( $url ) {
- return ForeignAPIRepo::httpGet( $url );
+ $cache = ObjectCache::getMainWANInstance();
+ return $cache->getWithSetCallback(
+ $this->getLocalCacheKey( get_class( $this ), $target, md5( $url ) ),
+ $cacheTTL,
+ function ( $curValue, &$ttl ) use ( $url, $cache ) {
+ $html = self::httpGet( $url, 'default', [], $mtime );
+ if ( $html !== false ) {
+ $ttl = $mtime ? $cache->adaptiveTTL( $mtime, $ttl ) : $ttl;
+ } else {
+ $ttl = $cache->adaptiveTTL( $mtime, $ttl );
+ $html = null; // caches negatives