BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
ParserCache Class Reference
Inheritance diagram for ParserCache:
Collaboration diagram for ParserCache:

Public Member Functions

 __construct (BagOStuff $cache, $cacheEpoch= '20030516000000')
 
 deleteOptionsKey ($page)
 
 getETag ($article, $popts)
 
 getDirty ($article, $popts)
 
 getKey ($article, $popts, $useOutdated=self::USE_ANYTHING)
 
 save ($parserOutput, $page, $popts, $cacheTime=null, $revId=null)
 
 getCacheStorage ()
 

Static Public Member Functions

static singleton ()
 

Public Attributes

const USE_CURRENT_ONLY = 0
 
const USE_EXPIRED = 1
 
const USE_OUTDATED = 2
 
const USE_ANYTHING = 3
 

Protected Member Functions

 getParserOutputKey ($article, $hash)
 
 getOptionsKey ($page)
 

Detailed Description

Todo:
document

Constructor & Destructor Documentation

ParserCache::__construct ( BagOStuff  $cache,
  $cacheEpoch = '20030516000000' 
)

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.

Parameters
BagOStuff$cache
string$cacheEpochAnything before this timestamp is invalidated
Exceptions
MWException

Member Function Documentation

ParserCache::deleteOptionsKey (   $page)
Parameters
WikiPage$page
Since
1.28
ParserCache::getCacheStorage ( )

Get the backend BagOStuff instance that powers the parser cache

Since
1.30
Returns
BagOStuff
ParserCache::getDirty (   $article,
  $popts 
)

Retrieve the ParserOutput from ParserCache, even if it's outdated.

Parameters
WikiPage$article
ParserOptions$popts
Returns
ParserOutput|bool False on failure
ParserCache::getETag (   $article,
  $popts 
)

Provides an E-Tag suitable for the whole page. Note that $article 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 $article. For example give a Chinese interface to a user with English preferences. That's why we take into account all user options. (r70809 CR)

Parameters
WikiPage$article
ParserOptions$popts
Returns
string
ParserCache::getKey (   $article,
  $popts,
  $useOutdated = self::USE_ANYTHING 
)

Generates a key for caching the given article considering the given parser options.

Note
Which parser options influence the cache key is controlled via ParserOutput::recordOption() or ParserOptions::addExtraKey().
Used by Article to provide a unique id for the PoolCounter. It would be preferable to have this code in get() instead of having Article looking in our internals.
Parameters
WikiPage$article
ParserOptions$popts
int | bool$useOutdatedOne of the USE constants. For backwards compatibility, boolean false is treated as USE_CURRENT_ONLY and boolean true is treated as USE_ANYTHING.
Returns
bool|mixed|string
Since
1.30 Changed $useOutdated to an int and added the non-boolean values
ParserCache::getOptionsKey (   $page)
protected
Parameters
WikiPage$page
Returns
mixed|string
ParserCache::getParserOutputKey (   $article,
  $hash 
)
protected
Parameters
WikiPage$article
string$hash
Returns
mixed|string
ParserCache::save (   $parserOutput,
  $page,
  $popts,
  $cacheTime = null,
  $revId = null 
)
Parameters
ParserOutput$parserOutput
WikiPage$page
ParserOptions$popts
string | null$cacheTimeTS_MW timestamp when the cache was generated
int | null$revIdRevision ID that was parsed
static ParserCache::singleton ( )
static

Get an instance of this object

Deprecated:
since 1.30, use MediaWikiServices instead
Returns
ParserCache

Member Data Documentation

const ParserCache::USE_ANYTHING = 3

Use expired data and data from different revisions, and if all else fails vary on all variable options

const ParserCache::USE_CURRENT_ONLY = 0

Constants for self::getKey()

Since
1.30Use only current data
const ParserCache::USE_EXPIRED = 1

Use expired data if current data is unavailable

const ParserCache::USE_OUTDATED = 2

Use expired data or data from different revisions if current data is unavailable


The documentation for this class was generated from the following file: