MediaWiki  REL1_22
LinkCache Class Reference

Cache for article titles (prefixed DB keys) and ids linked from one source. More...

List of all members.

Public Member Functions

 addBadLinkObj ($title)
 addGoodLinkObj ($id, $title, $len=-1, $redir=null, $revision=false, $model=false)
 Add a link for the title to the link cache.
 addGoodLinkObjFromRow ($title, $row)
 Same as above with better interface.
 addLink ($title)
 Add a title to the link cache, return the page_id or zero if non-existent.
 addLinkObj ($nt)
 Add a title to the link cache, return the page_id or zero if non-existent.
 clear ()
 Clears cache.
 clearBadLink ($title)
 clearLink ($title)
 forUpdate ($update=null)
 General accessor to get/set whether SELECT FOR UPDATE should be used.
 getBadLinks ()
 getGoodLinkFieldObj ($title, $field)
 Get a field of a title object from cache.
 getGoodLinkID ($title)
 getGoodLinks ()
 isBadLink ($title)
 useDatabase ($value=null)
 Enable or disable database use.

Static Public Member Functions

static destroySingleton ()
 Destroy the singleton instance, a new one will be created next time singleton() is called.
static setSingleton (LinkCache $instance)
 Set the singleton instance to a given object.
static & singleton ()
 Get an instance of this class.

Static Protected Attributes

static $instance

Private Attributes

 $mBadLinks = array()
 $mClassVer = 4
 $mForUpdate = false
 $mGoodLinkFields = array()
 $mGoodLinks = array()
 $useDatabase = true

Detailed Description

Cache for article titles (prefixed DB keys) and ids linked from one source.

Definition at line 29 of file LinkCache.php.


Member Function Documentation

Parameters:
$titleTitle

Definition at line 164 of file LinkCache.php.

References $title, and isBadLink().

Referenced by addLinkObj().

LinkCache::addGoodLinkObj ( id,
title,
len = -1,
redir = null,
revision = false,
model = false 
)

Add a link for the title to the link cache.

Parameters:
$idInteger: page's ID
$titleTitle object
$lenInteger: text's length
$redirInteger: whether the page is a redirect
$revisionInteger: latest revision's ID
$modelInteger: latest revision's content model ID

Definition at line 133 of file LinkCache.php.

References $title, and array().

LinkCache::addGoodLinkObjFromRow ( title,
row 
)

Same as above with better interface.

Since:
1.19
Parameters:
$titleTitle
$rowobject which has the fields page_id, page_is_redirect, page_latest and page_content_model

Definition at line 150 of file LinkCache.php.

References $title, array(), and empty.

Referenced by addLinkObj().

LinkCache::addLink ( title)

Add a title to the link cache, return the page_id or zero if non-existent.

Parameters:
string$titletitle to add
Returns:
Integer

Definition at line 199 of file LinkCache.php.

References $title, addLinkObj(), and Title\newFromDBkey().

Add a title to the link cache, return the page_id or zero if non-existent.

Parameters:
$ntTitle object to add
Returns:
Integer

Definition at line 227 of file LinkCache.php.

References $f, $key, $options, $s, addBadLinkObj(), addGoodLinkObjFromRow(), array(), getGoodLinkID(), global, isBadLink(), useDatabase(), wfGetDB(), wfProfileIn(), and wfProfileOut().

Referenced by addLink().

Clears cache.

Definition at line 289 of file LinkCache.php.

References array().

Definition at line 171 of file LinkCache.php.

References $title.

LinkCache::clearLink ( title)
Parameters:
$titleTitle

Definition at line 178 of file LinkCache.php.

References $title.

static LinkCache::destroySingleton ( ) [static]

Destroy the singleton instance, a new one will be created next time singleton() is called.

Since:
1.22

Definition at line 63 of file LinkCache.php.

LinkCache::forUpdate ( update = null)

General accessor to get/set whether SELECT FOR UPDATE should be used.

Returns:
bool

Definition at line 83 of file LinkCache.php.

References wfSetVar().

Definition at line 189 of file LinkCache.php.

LinkCache::getGoodLinkFieldObj ( title,
field 
)

Get a field of a title object from cache.

If this link is not good, it will return NULL.

Parameters:
$titleTitle
string$field('length','redirect','revision','model')
Returns:
mixed

Definition at line 106 of file LinkCache.php.

References $title.

Parameters:
$title
Returns:
array|int

Definition at line 91 of file LinkCache.php.

References $title.

Referenced by addLinkObj().

Definition at line 185 of file LinkCache.php.

LinkCache::isBadLink ( title)
Parameters:
$title
Returns:
bool

Definition at line 119 of file LinkCache.php.

References $title.

Referenced by addBadLinkObj(), and addLinkObj().

static LinkCache::setSingleton ( LinkCache instance) [static]

Set the singleton instance to a given object.

Since we do not have an interface for LinkCache, you have to be sure the given object implements all the LinkCache public methods.

Parameters:
LinkCache$instance
Since:
1.22

Definition at line 74 of file LinkCache.php.

References $instance.

LinkCache::useDatabase ( value = null)

Enable or disable database use.

Since:
1.22
Parameters:
$valueBoolean
Returns:
Boolean

Definition at line 214 of file LinkCache.php.

References $value.

Referenced by addLinkObj().


Member Data Documentation

LinkCache::$instance [static, protected]

Definition at line 43 of file LinkCache.php.

Referenced by setSingleton(), and singleton().

LinkCache::$mBadLinks = array() [private]

Definition at line 36 of file LinkCache.php.

LinkCache::$mClassVer = 4 [private]

Definition at line 32 of file LinkCache.php.

LinkCache::$mForUpdate = false [private]

Definition at line 37 of file LinkCache.php.

LinkCache::$mGoodLinkFields = array() [private]

Definition at line 35 of file LinkCache.php.

LinkCache::$mGoodLinks = array() [private]

Definition at line 34 of file LinkCache.php.

LinkCache::$useDatabase = true [private]

Definition at line 38 of file LinkCache.php.


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