From 665cb71037862e66e6c32b5175a915a7bf4fb92f Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 28 Feb 2019 12:54:49 -0800 Subject: [PATCH] parser: Convert wikitext Preprocessor class to using WAN cache Change-Id: Ida96a976109f7ceee0003b9d1d487c8cf9b80114 --- includes/parser/Preprocessor.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/includes/parser/Preprocessor.php b/includes/parser/Preprocessor.php index b6084d885b..bdfedd6441 100644 --- a/includes/parser/Preprocessor.php +++ b/includes/parser/Preprocessor.php @@ -22,6 +22,7 @@ */ use MediaWiki\Logger\LoggerFactory; +use MediaWiki\MediaWikiServices; /** * @ingroup Parser @@ -73,10 +74,12 @@ abstract class Preprocessor { return; } - $cache = ObjectCache::getLocalClusterInstance(); + $cache = MediaWikiServices::getInstance()->getMainWANObjectCache(); $key = $cache->makeKey( defined( 'static::CACHE_PREFIX' ) ? static::CACHE_PREFIX : static::class, - md5( $text ), $flags ); + md5( $text ), + $flags + ); $value = sprintf( "%08d", static::CACHE_VERSION ) . $tree; $cache->set( $key, $value, 86400 ); @@ -102,11 +105,13 @@ abstract class Preprocessor { return false; } - $cache = ObjectCache::getLocalClusterInstance(); + $cache = MediaWikiServices::getInstance()->getMainWANObjectCache(); $key = $cache->makeKey( defined( 'static::CACHE_PREFIX' ) ? static::CACHE_PREFIX : static::class, - md5( $text ), $flags ); + md5( $text ), + $flags + ); $value = $cache->get( $key ); if ( !$value ) { -- 2.20.1