From: Aaron Schulz Date: Mon, 26 Oct 2015 08:05:08 +0000 (-0700) Subject: Convert ForeignApiRepo::httpGetCached() to the WAN cache X-Git-Tag: 1.31.0-rc.0~9210^2 X-Git-Url: http://git.cyclocoop.org//%22%22.str_replace%28%27%22%27%2C?a=commitdiff_plain;h=14e377083c820b5ad1868a61696107de45042dd4;p=lhc%2Fweb%2Fwiklou.git Convert ForeignApiRepo::httpGetCached() to the WAN cache Change-Id: I4f1098a6e98570fc4fea6941ffcd64540d6caebd --- diff --git a/includes/filerepo/ForeignAPIRepo.php b/includes/filerepo/ForeignAPIRepo.php index 4ffbf4add2..38305dca1b 100644 --- a/includes/filerepo/ForeignAPIRepo.php +++ b/includes/filerepo/ForeignAPIRepo.php @@ -552,19 +552,16 @@ class ForeignAPIRepo extends FileRepo { } if ( !isset( $this->mQueryCache[$url] ) ) { - global $wgMemc; - - $key = $this->getLocalCacheKey( get_class( $this ), $target, md5( $url ) ); - $data = $wgMemc->get( $key ); - - if ( !$data ) { - $data = self::httpGet( $url ); - - if ( !$data ) { - return null; + $data = ObjectCache::getMainWANInstance()->getWithSetCallback( + $this->getLocalCacheKey( get_class( $this ), $target, md5( $url ) ), + $cacheTTL, + function () use ( $url ) { + return ForeignAPIRepo::httpGet( $url ); } + ); - $wgMemc->set( $key, $data, $cacheTTL ); + if ( !$data ) { + return null; } if ( count( $this->mQueryCache ) > 100 ) {