Legoktm has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/355644 )

Change subject: parser: Avoid deprecated wfMemcKey()
......................................................................

parser: Avoid deprecated wfMemcKey()

Tested that parser cache keys stay the same, before and after this
change.

Also use the more obvious ObjectCache::getLocalClusterInstance() instead
of looking up the main cache type in config and using
ObjectCache::getInstance().

Change-Id: Icef646b3c05e732ef4079d6900e6bce111debf2b
---
M includes/parser/ParserCache.php
M includes/parser/Preprocessor.php
2 files changed, 6 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/44/355644/1

diff --git a/includes/parser/ParserCache.php b/includes/parser/ParserCache.php
index f76c0b5..76a7e1e 100644
--- a/includes/parser/ParserCache.php
+++ b/includes/parser/ParserCache.php
@@ -67,7 +67,7 @@
                $pageid = $article->getId();
                $renderkey = (int)( $wgRequest->getVal( 'action' ) == 'render' 
);
 
-               $key = wfMemcKey( 'pcache', 'idhash', 
"{$pageid}-{$renderkey}!{$hash}" );
+               $key = $this->mMemc->makeKey( 'pcache', 'idhash', 
"{$pageid}-{$renderkey}!{$hash}" );
                return $key;
        }
 
@@ -76,7 +76,7 @@
         * @return mixed|string
         */
        protected function getOptionsKey( $page ) {
-               return wfMemcKey( 'pcache', 'idoptions', $page->getId() );
+               return $this->mMemc->makeKey( 'pcache', 'idoptions', 
$page->getId() );
        }
 
        /**
diff --git a/includes/parser/Preprocessor.php b/includes/parser/Preprocessor.php
index cb8e3a7..24474d5 100644
--- a/includes/parser/Preprocessor.php
+++ b/includes/parser/Preprocessor.php
@@ -72,12 +72,12 @@
                        return false;
                }
 
-               $key = wfMemcKey(
+               $cache = ObjectCache::getLocalClusterInstance();
+               $key = $cache->makeKey(
                        defined( 'static::CACHE_PREFIX' ) ? 
static::CACHE_PREFIX : static::class,
                        md5( $text ), $flags );
                $value = sprintf( "%08d", static::CACHE_VERSION ) . $tree;
 
-               $cache = ObjectCache::getInstance( $config->get( 
'MainCacheType' ) );
                $cache->set( $key, $value, 86400 );
 
                LoggerFactory::getInstance( 'Preprocessor' )
@@ -101,9 +101,9 @@
                        return false;
                }
 
-               $cache = ObjectCache::getInstance( $config->get( 
'MainCacheType' ) );
+               $cache = ObjectCache::getLocalClusterInstance();
 
-               $key = wfMemcKey(
+               $key = $cache->makeKey(
                        defined( 'static::CACHE_PREFIX' ) ? 
static::CACHE_PREFIX : static::class,
                        md5( $text ), $flags );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/355644
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icef646b3c05e732ef4079d6900e6bce111debf2b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to