And the deprecated ObjectCache::getMainWANInstance() while we're at it.
Change-Id: Id7bb6a8c3e8269345e054d2c2bf202304b74c3cf
$revid = $revision ? $revision->getId() : null;
}
if ( $revid !== null ) {
$revid = $revision ? $revision->getId() : null;
}
if ( $revid !== null ) {
- $key = self::getCacheKey( $title, $revid );
- ObjectCache::getMainWANInstance()->delete( $key );
+ $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
+ $key = self::getCacheKey( $cache, $title, $revid );
+ $cache->delete( $key );
protected function pageCounts( Page $page ) {
$fname = __METHOD__;
$config = $this->context->getConfig();
protected function pageCounts( Page $page ) {
$fname = __METHOD__;
$config = $this->context->getConfig();
+ $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
- return ObjectCache::getMainWANInstance()->getWithSetCallback(
- self::getCacheKey( $page->getTitle(), $page->getLatest() ),
+ return $cache->getWithSetCallback(
+ self::getCacheKey( $cache, $page->getTitle(), $page->getLatest() ),
WANObjectCache::TTL_WEEK,
function ( $oldValue, &$ttl, &$setOpts ) use ( $page, $config, $fname ) {
$title = $page->getTitle();
WANObjectCache::TTL_WEEK,
function ( $oldValue, &$ttl, &$setOpts ) use ( $page, $config, $fname ) {
$title = $page->getTitle();
+ * @param WANObjectCache $cache
* @param Title $title
* @param int $revId
* @return string
*/
* @param Title $title
* @param int $revId
* @return string
*/
- protected static function getCacheKey( Title $title, $revId ) {
- return wfMemcKey( 'infoaction', md5( $title->getPrefixedText() ), $revId, self::VERSION );
+ protected static function getCacheKey( WANObjectCache $cache, Title $title, $revId ) {
+ return $cache->makeKey( 'infoaction', md5( $title->getPrefixedText() ), $revId, self::VERSION );