54 'names' => [ 2 => null ],
60 'names' => [ 2 => null ],
76 $length = strlen( $text );
77 $threshold = $config->get(
'PreprocessorCacheThreshold' );
78 if ( $threshold ===
false || $length < $threshold || $length > 1e6 ) {
82 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
85 defined(
'static::CACHE_PREFIX' ) ? static::CACHE_PREFIX : static::class,
89 $value = sprintf(
"%08d", static::CACHE_VERSION ) . $tree;
91 $cache->set( $key, $value, 86400 );
93 LoggerFactory::getInstance(
'Preprocessor' )
94 ->info(
"Cached preprocessor output (key: $key)" );
108 $length = strlen( $text );
109 $threshold = $config->get(
'PreprocessorCacheThreshold' );
110 if ( $threshold ===
false || $length < $threshold || $length > 1e6 ) {
114 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
118 defined(
'static::CACHE_PREFIX' ) ? static::CACHE_PREFIX : static::class,
123 $value =
$cache->get( $key );
128 $version = intval( substr( $value, 0, 8 ) );
129 if ( $version !== static::CACHE_VERSION ) {
133 LoggerFactory::getInstance(
'Preprocessor' )
134 ->info(
"Loaded preprocessor output from cache (key: $key)" );
136 return substr( $value, 8 );
144 abstract public function newFrame();