MediaWiki
master
ParserCacheFilter.php
Go to the documentation of this file.
1
<?php
8
namespace
MediaWiki\Parser
;
9
10
use
MediaWiki\Page\PageRecord
;
11
19
class
ParserCacheFilter
{
20
24
private
array $config;
25
29
public
function
__construct
( array $config ) {
30
$this->config = $config;
31
}
32
33
public
function
shouldCache
(
34
ParserOutput
$output,
35
PageRecord
$page,
36
ParserOptions
$options
37
): bool {
38
$ns = $page->getNamespace();
39
$cpuMin = $this->config[ $ns ][
'minCpuTime'
]
40
?? ( $this->config[
'default'
][
'minCpuTime'
] ?? 0 );
41
42
$cpuTime = $output->
getTimeProfile
(
'cpu'
);
43
44
if
( $cpuTime !==
null
&& $cpuTime < $cpuMin ) {
45
return
false
;
46
}
47
48
return
true
;
49
}
50
51
}
MediaWiki\Parser\ParserCacheFilter
Filter that decides whether a ParserOutput object should be stored in the ParserCache or not.
Definition
ParserCacheFilter.php:19
MediaWiki\Parser\ParserCacheFilter\__construct
__construct(array $config)
Definition
ParserCacheFilter.php:29
MediaWiki\Parser\ParserCacheFilter\shouldCache
shouldCache(ParserOutput $output, PageRecord $page, ParserOptions $options)
Definition
ParserCacheFilter.php:33
MediaWiki\Parser\ParserOptions
Set options of the Parser.
Definition
ParserOptions.php:70
MediaWiki\Parser\ParserOutput
ParserOutput is a rendering of a Content object or a message.
Definition
ParserOutput.php:91
MediaWiki\Parser\ParserOutput\getTimeProfile
getTimeProfile(string $clock)
Returns the time that elapsed between the most recent call to resetParseStartTime() and the first cal...
Definition
ParserOutput.php:2383
MediaWiki\Page\PageRecord
Data record representing a page that is (or used to be, or could be) an editable page on a wiki.
Definition
PageRecord.php:26
MediaWiki\Parser
Definition
BlockLevelPass.php:13
includes
Parser
ParserCacheFilter.php
Generated on Tue Oct 6 2026 08:25:51 for MediaWiki by
1.10.0