Public Member Functions | |
__construct ($title) | |
Create a new BacklinkCache. | |
clear () | |
Clear locally stored data. | |
setDB ($db) | |
Set the Database object to use. | |
getLinks ($table, $startId=false, $endId=false) | |
Get the backlinks for a given table. | |
getNumLinks ($table) | |
Get the approximate number of backlinks. | |
partition ($table, $batchSize) | |
Partition the backlinks into batches. | |
Public Attributes | |
$partitionCache = array() | |
$fullResultCache = array() | |
$title | |
$db | |
const | CACHE_EXPIRY = 3600 |
Protected Member Functions | |
getDB () | |
getPrefix ($table) | |
Get the field name prefix for a given table. | |
getConditions ($table) | |
Get the SQL condition array for selecting backlinks, with a join on the page table. | |
partitionResult ($res, $batchSize) | |
Partition a DB result with backlinks in it into batches. |
Instances of this class should typically be fetched with $title->getBacklinkCache().
Ideally you should only get your backlinks from here when you think there is some advantage in caching them. Otherwise it's just a waste of memory.
Definition at line 10 of file BacklinkCache.php.
BacklinkCache::__construct | ( | $ | title | ) |
BacklinkCache::clear | ( | ) |
BacklinkCache::getConditions | ( | $ | table | ) | [protected] |
Get the SQL condition array for selecting backlinks, with a join on the page table.
Definition at line 116 of file BacklinkCache.php.
References $conds, $prefix, and getPrefix().
Referenced by getLinks().
BacklinkCache::getDB | ( | ) | [protected] |
BacklinkCache::getLinks | ( | $ | table, | |
$ | startId = false , |
|||
$ | endId = false | |||
) |
Get the backlinks for a given table.
Cached in process memory only.
string | $table |
Definition at line 53 of file BacklinkCache.php.
References $conds, $endId, $res, $startId, getConditions(), getDB(), getPrefix(), TitleArray::newFromResult(), wfDebug(), wfProfileIn(), and wfProfileOut().
Referenced by getNumLinks(), and partition().
BacklinkCache::getNumLinks | ( | $ | table | ) |
Get the approximate number of backlinks.
Definition at line 149 of file BacklinkCache.php.
References getLinks().
BacklinkCache::getPrefix | ( | $ | table | ) | [protected] |
Get the field name prefix for a given table.
Definition at line 98 of file BacklinkCache.php.
References $prefixes.
Referenced by getConditions(), and getLinks().
BacklinkCache::partition | ( | $ | table, | |
$ | batchSize | |||
) |
Partition the backlinks into batches.
Returns an array giving the start and end of each range. The first batch has a start of false, and the last batch has an end of false.
string | $table The links table name | |
integer | $batchSize |
Definition at line 170 of file BacklinkCache.php.
References $batchSize, $wgMemc, getLinks(), partitionResult(), wfDebug(), and wfMemcKey().
BacklinkCache::partitionResult | ( | $ | res, | |
$ | batchSize | |||
) | [protected] |
Partition a DB result with backlinks in it into batches.
Definition at line 207 of file BacklinkCache.php.
References $batchSize, $end, $i, $numRows, $res, $row, and $start.
Referenced by partition().
BacklinkCache::setDB | ( | $ | db | ) |
BacklinkCache::$db |
BacklinkCache::$fullResultCache = array() |
Definition at line 12 of file BacklinkCache.php.
BacklinkCache::$partitionCache = array() |
Definition at line 11 of file BacklinkCache.php.
BacklinkCache::$title |
const BacklinkCache::CACHE_EXPIRY = 3600 |
Definition at line 16 of file BacklinkCache.php.