MediaWiki
1.27.0
|
Cache for article titles (prefixed DB keys) and ids linked from one source. More...
Public Member Functions | |
__construct () | |
addBadLinkObj (Title $title) | |
addGoodLinkObj ($id, Title $title, $len=-1, $redir=null, $revision=0, $model=null, $lang=null) | |
Add a link for the title to the link cache. More... | |
addGoodLinkObjFromRow (Title $title, $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 (Title $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 (Title $title) | |
forUpdate ($update=null) | |
General accessor to get/set whether the master DB should be used. More... | |
getGoodLinkFieldObj (Title $title, $field) | |
Get a field of a title object from cache. More... | |
getGoodLinkID ($title) | |
isBadLink ($title) | |
Static Public Member Functions | |
static | destroySingleton () |
Destroy the singleton instance. More... | |
static | setSingleton (LinkCache $instance) |
Set the singleton instance to a given object. More... | |
static | singleton () |
Get an instance of this class. More... | |
Public Attributes | |
const | MAX_SIZE = 10000 |
How many Titles to store. More... | |
Static Protected Attributes | |
static LinkCache | $instance |
Private Attributes | |
HashBagOStuff | $mBadLinks |
$mForUpdate = false | |
HashBagOStuff | $mGoodLinks |
Cache for article titles (prefixed DB keys) and ids linked from one source.
Definition at line 29 of file LinkCache.php.
LinkCache::__construct | ( | ) |
Definition at line 51 of file LinkCache.php.
LinkCache::addBadLinkObj | ( | Title | $title | ) |
Title | $title |
Definition at line 191 of file LinkCache.php.
References Title\getPrefixedDBkey(), and isBadLink().
Referenced by addLinkObj().
LinkCache::addGoodLinkObj | ( | $id, | |
Title | $title, | ||
$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 |
Title | $title | |
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 155 of file LinkCache.php.
References $lang, and Title\getPrefixedDBkey().
LinkCache::addGoodLinkObjFromRow | ( | Title | $title, |
$row | |||
) |
Same as above with better interface.
Title | $title | |
stdClass | $row | Object which has the fields page_id, page_is_redirect, page_latest and page_content_model |
Definition at line 176 of file LinkCache.php.
References Title\getPrefixedDBkey().
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 220 of file LinkCache.php.
References $title, addLinkObj(), and Title\newFromDBkey().
LinkCache::addLinkObj | ( | Title | $nt | ) |
Add a title to the link cache, return the page_id or zero if non-existent.
Definition at line 234 of file LinkCache.php.
References $key, addBadLinkObj(), addGoodLinkObjFromRow(), DB_MASTER, DB_SLAVE, Title\getDBkey(), getGoodLinkID(), Title\getNamespace(), Title\getPrefixedDBkey(), global, isBadLink(), Title\isExternal(), and wfGetDB().
Referenced by addLink().
LinkCache::clear | ( | ) |
Clears cache.
Definition at line 280 of file LinkCache.php.
LinkCache::clearBadLink | ( | $title | ) |
string | $title | Prefixed DB key |
Definition at line 201 of file LinkCache.php.
References $title.
LinkCache::clearLink | ( | Title | $title | ) |
Title | $title |
Definition at line 208 of file LinkCache.php.
References Title\getPrefixedDBkey().
|
static |
Destroy the singleton instance.
A new one will be created next time singleton() is called.
Definition at line 76 of file LinkCache.php.
Referenced by ContentHandlerTest\setUp(), and ContentHandlerTest\tearDown().
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 103 of file LinkCache.php.
References wfSetVar().
LinkCache::getGoodLinkFieldObj | ( | Title | $title, |
$field | |||
) |
Get a field of a title object from cache.
If this link is not a cached good title, it will return NULL.
Title | $title | |
string | $field | ('length','redirect','revision','model') |
Definition at line 126 of file LinkCache.php.
References Title\getPrefixedDBkey().
LinkCache::getGoodLinkID | ( | $title | ) |
string | $title | Prefixed DB key |
Definition at line 111 of file LinkCache.php.
References $title.
Referenced by addLinkObj().
LinkCache::isBadLink | ( | $title | ) |
string | $title | Prefixed DB key |
Definition at line 139 of file LinkCache.php.
References $title.
Referenced by addBadLinkObj(), and addLinkObj().
|
static |
|
static |
Get an instance of this class.
Definition at line 61 of file LinkCache.php.
Referenced by OutputPage\addCategoryLinks(), NewParserTest\addDBDataOnce(), Title\clearCaches(), LinkHolderArray\doVariants(), LinkBatch\execute(), 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().
|
staticprotected |
Definition at line 49 of file LinkCache.php.
Referenced by setSingleton().
|
private |
Definition at line 37 of file LinkCache.php.
|
private |
Definition at line 38 of file LinkCache.php.
|
private |
Definition at line 33 of file LinkCache.php.
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 44 of file LinkCache.php.