MediaWiki
master
|
Cache for article titles (prefixed DB keys) and ids linked from one source. More...
Public Member Functions | |
__construct (TitleFormatter $titleFormatter) | |
addBadLinkObj (LinkTarget $target) | |
addGoodLinkObj ($id, LinkTarget $target, $len=-1, $redir=null, $revision=0, $model=null, $lang=null) | |
Add a link for the title to the link cache. More... | |
addGoodLinkObjFromRow (LinkTarget $target, $row) | |
Same as above with better interface. More... | |
addLink ($title) | |
Add a title to the link cache, return the page_id or zero if non-existent. More... | |
addLinkObj (LinkTarget $nt) | |
Add a title to the link cache, return the page_id or zero if non-existent. More... | |
clear () | |
Clears cache. More... | |
clearBadLink ($title) | |
clearLink (LinkTarget $target) | |
forUpdate ($update=null) | |
General accessor to get/set whether the master DB should be used. More... | |
getGoodLinkFieldObj (LinkTarget $target, $field) | |
Get a field of a title object from cache. More... | |
getGoodLinkID ($title) | |
isBadLink ($title) | |
Static Public Member Functions | |
static | getSelectFields () |
Fields that LinkCache needs to select. More... | |
static | singleton () |
Get an instance of this class. More... | |
Public Attributes | |
const | MAX_SIZE = 10000 |
How many Titles to store. More... | |
Private Attributes | |
HashBagOStuff | $mBadLinks |
$mForUpdate = false | |
HashBagOStuff | $mGoodLinks |
TitleFormatter | $titleFormatter |
Cache for article titles (prefixed DB keys) and ids linked from one source.
Definition at line 31 of file LinkCache.php.
LinkCache::__construct | ( | TitleFormatter | $titleFormatter | ) |
Definition at line 53 of file LinkCache.php.
References $titleFormatter.
LinkCache::addBadLinkObj | ( | LinkTarget | $target | ) |
LinkTarget | $target |
Definition at line 167 of file LinkCache.php.
References isBadLink().
Referenced by addLinkObj().
LinkCache::addGoodLinkObj | ( | $id, | |
LinkTarget | $target, | ||
$len = -1 , |
|||
$redir = null , |
|||
$revision = 0 , |
|||
$model = null , |
|||
$lang = null |
|||
) |
Add a link for the title to the link cache.
int | $id | Page's ID |
LinkTarget | $target | |
int | $len | Text's length |
int | $redir | Whether the page is a redirect |
int | $revision | Latest revision's ID |
string | null | $model | Latest revision's content model ID |
string | null | $lang | Language code of the page, if not the content language |
Definition at line 131 of file LinkCache.php.
References $lang.
LinkCache::addGoodLinkObjFromRow | ( | LinkTarget | $target, |
$row | |||
) |
Same as above with better interface.
LinkTarget | $target | |
stdClass | $row | Object which has the fields page_id, page_is_redirect, page_latest and page_content_model |
Definition at line 152 of file LinkCache.php.
Referenced by addLinkObj().
LinkCache::addLink | ( | $title | ) |
Add a title to the link cache, return the page_id or zero if non-existent.
string | $title | Prefixed DB key |
Definition at line 197 of file LinkCache.php.
References $title, addLinkObj(), and Title\newFromDBkey().
LinkCache::addLinkObj | ( | LinkTarget | $nt | ) |
Add a title to the link cache, return the page_id or zero if non-existent.
LinkTarget | $nt | LinkTarget object to add |
Definition at line 231 of file LinkCache.php.
References addBadLinkObj(), addGoodLinkObjFromRow(), DB_MASTER, DB_SLAVE, MediaWiki\Linker\LinkTarget\getDBkey(), getGoodLinkID(), MediaWiki\Linker\LinkTarget\getNamespace(), MediaWiki\Linker\LinkTarget\inNamespace(), isBadLink(), MediaWiki\Linker\LinkTarget\isExternal(), NS_SPECIAL, and wfGetDB().
Referenced by addLink().
LinkCache::clear | ( | ) |
Clears cache.
Definition at line 269 of file LinkCache.php.
LinkCache::clearBadLink | ( | $title | ) |
string | $title | Prefixed DB key |
Definition at line 177 of file LinkCache.php.
References $title.
LinkCache::clearLink | ( | LinkTarget | $target | ) |
LinkTarget | $target |
Definition at line 184 of file LinkCache.php.
LinkCache::forUpdate | ( | $update = null | ) |
General accessor to get/set whether the master DB should be used.
This used to also set the FOR UPDATE option (locking the rows read in order to avoid link table inconsistency), which was later removed for performance on wikis with a high edit rate.
bool | $update |
Definition at line 79 of file LinkCache.php.
References wfSetVar().
LinkCache::getGoodLinkFieldObj | ( | LinkTarget | $target, |
$field | |||
) |
Get a field of a title object from cache.
If this link is not a cached good title, it will return NULL.
LinkTarget | $target | |
string | $field | ('length','redirect','revision','model') |
Definition at line 102 of file LinkCache.php.
LinkCache::getGoodLinkID | ( | $title | ) |
string | $title | Prefixed DB key |
Definition at line 87 of file LinkCache.php.
References $title.
Referenced by addLinkObj().
|
static |
Fields that LinkCache needs to select.
Definition at line 211 of file LinkCache.php.
References $wgContentHandlerUseDB, $wgPageLanguageUseDB, and global.
Referenced by OutputPage\addCategoryLinks(), LinkBatch\doQuery(), LinkHolderArray\doVariants(), LinkHolderArray\replaceInternal(), and SpecialPrefixindex\showPrefixChunk().
LinkCache::isBadLink | ( | $title | ) |
string | $title | Prefixed DB key |
Definition at line 115 of file LinkCache.php.
References $title.
Referenced by addBadLinkObj(), and addLinkObj().
|
static |
Get an instance of this class.
Definition at line 65 of file LinkCache.php.
Referenced by OutputPage\addCategoryLinks(), NewParserTest\addDBDataOnce(), Title\clearCaches(), LinkHolderArray\doVariants(), JobRunner\executeJob(), RefreshLinks\fixLinksFromArticle(), Title\getArticleID(), Title\getContentModel(), Title\getDbPageLanguageCode(), Title\getLatestRevID(), Title\getLength(), Title\getLinksFrom(), Title\getLinksTo(), Title\isRedirect(), WikiPage\loadFromRow(), TitleCleanup\moveInconsistentPage(), CoreParserFunctions\pageid(), LinkHolderArray\replaceInternal(), Title\resetArticleID(), MediaWikiTestCase\resetDB(), WikiPageTest\setUp(), ParserOptions\setupFakeRevision(), Parser\statelessFetchTemplate(), NewParserTest\tearDown(), ParserTest\teardownGlobals(), TitleMethodsTest\testClearCaches(), TitleTest\testExists(), ContentHandlerTest\testGetForTitle(), ContentHandlerTest\testGetPageLanguage(), ContentHandlerTest\testMakeContent(), and WikiPage\updateRevisionOn().
|
private |
Definition at line 39 of file LinkCache.php.
|
private |
Definition at line 40 of file LinkCache.php.
|
private |
Definition at line 35 of file LinkCache.php.
|
private |
Definition at line 45 of file LinkCache.php.
Referenced by __construct().
const LinkCache::MAX_SIZE = 10000 |
How many Titles to store.
There are two caches, so the amount actually stored in memory can be up to twice this.
Definition at line 51 of file LinkCache.php.