MediaWiki fundraising/REL1_35
|
Public Member Functions | |
__construct (BagOStuff $cache, $cacheEpoch='20030516000000', HookContainer $hookContainer=null, IBufferingStatsdDataFactory $stats=null) | |
Setup a cache pathway with a given back-end storage mechanism. | |
deleteOptionsKey (WikiPage $wikiPage) | |
get (Page $wikiPage, $popts, $useOutdated=false) | |
Retrieve the ParserOutput from ParserCache. | |
getCacheStorage () | |
Get the backend BagOStuff instance that powers the parser cache. | |
getDirty (WikiPage $wikiPage, $popts) | |
Retrieve the ParserOutput from ParserCache, even if it's outdated. | |
getETag (WikiPage $wikiPage, $popts) | |
Provides an E-Tag suitable for the whole page. | |
getKey (WikiPage $wikiPage, $popts, $useOutdated=self::USE_ANYTHING) | |
Generates a key for caching the given page considering the given parser options. | |
save (ParserOutput $parserOutput, WikiPage $wikiPage, $popts, $cacheTime=null, $revId=null) | |
Static Public Member Functions | |
static | singleton () |
Get an instance of this object. | |
Protected Member Functions | |
getOptionsKey (WikiPage $wikiPage) | |
getParserOutputKey (WikiPage $wikiPage, $hash) | |
Private Member Functions | |
incrementStats (WikiPage $wikiPage, $metricSuffix) | |
Private Attributes | |
BagOStuff | $cache |
string | $cacheEpoch |
Anything cached prior to this is invalidated. | |
HookRunner | $hookRunner |
IBufferingStatsdDataFactory | $stats |
const | USE_ANYTHING = 3 |
Use expired data and data from different revisions, and if all else fails vary on all variable options. | |
const | USE_CURRENT_ONLY = 0 |
Constants for self::getKey() | |
const | USE_EXPIRED = 1 |
Use expired data if current data is unavailable. | |
const | USE_OUTDATED = 2 |
Use expired data or data from different revisions if current data is unavailable. | |
Definition at line 32 of file ParserCache.php.
ParserCache::__construct | ( | BagOStuff | $cache, |
$cacheEpoch = '20030516000000', | |||
HookContainer | $hookContainer = null, | ||
IBufferingStatsdDataFactory | $stats = null ) |
Setup a cache pathway with a given back-end storage mechanism.
This class use an invalidation strategy that is compatible with MultiWriteBagOStuff in async replication mode.
BagOStuff | $cache | |
string | $cacheEpoch | Anything before this timestamp is invalidated |
HookContainer | null | $hookContainer | |
IBufferingStatsdDataFactory | null | $stats |
MWException |
Definition at line 92 of file ParserCache.php.
References $cache.
ParserCache::deleteOptionsKey | ( | WikiPage | $wikiPage | ) |
WikiPage | $wikiPage |
Definition at line 134 of file ParserCache.php.
References getOptionsKey().
ParserCache::get | ( | Page | $wikiPage, |
$popts, | |||
$useOutdated = false ) |
Retrieve the ParserOutput from ParserCache.
false if not found or outdated.
WikiPage | Article | Page | $wikiPage | Article is hard deprecated since 1.35 |
ParserOptions | $popts | |
bool | $useOutdated | (default false) |
Definition at line 267 of file ParserCache.php.
References getKey(), incrementStats(), wfDebug(), wfDebugLog(), and wfDeprecated().
ParserCache::getCacheStorage | ( | ) |
Get the backend BagOStuff instance that powers the parser cache.
Definition at line 409 of file ParserCache.php.
References $cache.
ParserCache::getDirty | ( | WikiPage | $wikiPage, |
$popts ) |
Retrieve the ParserOutput from ParserCache, even if it's outdated.
WikiPage | $wikiPage | |
ParserOptions | $popts |
Definition at line 170 of file ParserCache.php.
References true.
Referenced by RefreshLinksJob\getParserOutputFromCache().
ParserCache::getETag | ( | WikiPage | $wikiPage, |
$popts ) |
Provides an E-Tag suitable for the whole page.
Note that $wikiPage is just the main wikitext. The E-Tag has to be unique to the whole page, even if the article itself is the same, so it uses the complete set of user options. We don't want to use the preference of a different user on a message just because it wasn't used in $wikiPage. For example give a Chinese interface to a user with English preferences. That's why we take into account all user options. (r70809 CR)
WikiPage | $wikiPage | |
ParserOptions | $popts |
Definition at line 152 of file ParserCache.php.
References getParserOutputKey(), WikiPage\getTitle(), and WikiPage\getTouched().
ParserCache::getKey | ( | WikiPage | $wikiPage, |
$popts, | |||
$useOutdated = self::USE_ANYTHING ) |
Generates a key for caching the given page considering the given parser options.
WikiPage | $wikiPage | |
ParserOptions | $popts | |
int | bool | $useOutdated | One of the USE constants. For backwards compatibility, boolean false is treated as USE_CURRENT_ONLY and boolean true is treated as USE_ANYTHING. |
Definition at line 205 of file ParserCache.php.
References WikiPage\getLatest(), getOptionsKey(), getParserOutputKey(), WikiPage\getTitle(), WikiPage\getTouched(), incrementStats(), wfDebug(), wfDebugLog(), and wfWarn().
Referenced by get().
|
protected |
WikiPage | $wikiPage |
Definition at line 126 of file ParserCache.php.
References WikiPage\getId().
Referenced by deleteOptionsKey(), getKey(), and save().
|
protected |
WikiPage | $wikiPage | |
string | $hash |
Definition at line 111 of file ParserCache.php.
References $wgRequest, and WikiPage\getId().
|
private |
WikiPage | $wikiPage | |
string | $metricSuffix |
Definition at line 179 of file ParserCache.php.
References WikiPage\getContentModel().
ParserCache::save | ( | ParserOutput | $parserOutput, |
WikiPage | $wikiPage, | ||
$popts, | |||
$cacheTime = null, | |||
$revId = null ) |
ParserOutput | $parserOutput | |
WikiPage | $wikiPage | |
ParserOptions | $popts | |
string | null | $cacheTime | TS_MW timestamp when the cache was generated |
int | null | $revId | Revision ID that was parsed |
Definition at line 343 of file ParserCache.php.
References CacheTime\getCacheExpiry(), getOptionsKey(), getParserOutputKey(), WikiPage\getRevisionRecord(), WikiPage\getTimestamp(), WikiPage\getTitle(), ParserOutput\getUsedOptions(), ParserOutput\hasText(), CacheTime\setCacheRevisionId(), CacheTime\setCacheTime(), ParserOutput\setTimestamp(), wfDebug(), and wfTimestampNow().
|
static |
Get an instance of this object.
Definition at line 75 of file ParserCache.php.
References wfDeprecated().
|
private |
Definition at line 54 of file ParserCache.php.
|
private |
Anything cached prior to this is invalidated.
Definition at line 61 of file ParserCache.php.
|
private |
Definition at line 64 of file ParserCache.php.
|
private |
Definition at line 67 of file ParserCache.php.
|
private |
Use expired data and data from different revisions, and if all else fails vary on all variable options.
Definition at line 51 of file ParserCache.php.
|
private |
Constants for self::getKey()
Definition at line 39 of file ParserCache.php.
|
private |
Use expired data if current data is unavailable.
Definition at line 42 of file ParserCache.php.
|
private |
Use expired data or data from different revisions if current data is unavailable.
Definition at line 45 of file ParserCache.php.