X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fchanges%2FChangesFeed.php;h=dc588358cabed61a75779d6641526e09de0e0277;hb=de8f8c8248341c007ab6a9365a3c40614bcf04dc;hp=28a1ccadd43c6dcc1bf64a64be982dc81dfa5d14;hpb=f1a890c34cebd8744bf3a6277734275fb975575a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/changes/ChangesFeed.php b/includes/changes/ChangesFeed.php index 28a1ccadd4..dc588358ca 100644 --- a/includes/changes/ChangesFeed.php +++ b/includes/changes/ChangesFeed.php @@ -83,7 +83,8 @@ class ChangesFeed { } $optionsHash = md5( serialize( $opts->getAllValues() ) ) . $wgRenderHashAppend; - $timekey = wfMemcKey( $this->type, $this->format, $wgLang->getCode(), $optionsHash, 'timestamp' ); + $timekey = wfMemcKey( + $this->type, $this->format, $wgLang->getCode(), $optionsHash, 'timestamp' ); $key = wfMemcKey( $this->type, $this->format, $wgLang->getCode(), $optionsHash ); FeedUtils::checkPurge( $timekey, $key ); @@ -110,21 +111,20 @@ class ChangesFeed { } /** - * Save to feed result to $messageMemc + * Save to feed result to cache * * @param string $feed Feed's content * @param string $timekey Memcached key of the last modification * @param string $key Memcached key of the content */ public function saveToCache( $feed, $timekey, $key ) { - global $messageMemc; - $expire = 3600 * 24; # One day - $messageMemc->set( $key, $feed, $expire ); - $messageMemc->set( $timekey, wfTimestamp( TS_MW ), $expire ); + $cache = ObjectCache::getMainWANInstance(); + $cache->set( $key, $feed, $cache::TTL_DAY ); + $cache->set( $timekey, wfTimestamp( TS_MW ), $cache::TTL_DAY ); } /** - * Try to load the feed result from $messageMemc + * Try to load the feed result from cache * * @param int $lastmod Timestamp of the last item in the recentchanges table * @param string $timekey Memcached key of the last modification @@ -132,9 +132,10 @@ class ChangesFeed { * @return string|bool Feed's content on cache hit or false on cache miss */ public function loadFromCache( $lastmod, $timekey, $key ) { - global $wgFeedCacheTimeout, $wgOut, $messageMemc; + global $wgFeedCacheTimeout, $wgOut; - $feedLastmod = $messageMemc->get( $timekey ); + $cache = ObjectCache::getMainWANInstance(); + $feedLastmod = $cache->get( $timekey ); if ( ( $wgFeedCacheTimeout > 0 ) && $feedLastmod ) { /** @@ -153,7 +154,7 @@ class ChangesFeed { if ( $feedLastmodUnix < $lastmodUnix ) { $wgOut->setLastModified( $feedLastmod ); // bug 21916 } - return $messageMemc->get( $key ); + return $cache->get( $key ); } else { wfDebug( "RC: cached feed timestamp check failed ($feedLastmod; $lastmod)\n" ); } @@ -164,7 +165,7 @@ class ChangesFeed { /** * Generate the feed items given a row from the database, printing the feed. * @param object $rows DatabaseBase resource with recentchanges rows - * @param Feed $feed + * @param ChannelFeed $feed */ public static function generateFeed( $rows, &$feed ) { $items = self::buildItems( $rows );