BacklinkCache Class Reference

Class for fetching backlink lists, approximate backlink counts and partitions. More...

List of all members.

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.


Detailed Description

Class for fetching backlink lists, approximate backlink counts and partitions.

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.


Constructor & Destructor Documentation

BacklinkCache::__construct ( title  ) 

Create a new BacklinkCache.

Definition at line 21 of file BacklinkCache.php.

References $title.


Member Function Documentation

BacklinkCache::clear (  ) 

Clear locally stored data.

Definition at line 28 of file BacklinkCache.php.

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]

Definition at line 41 of file BacklinkCache.php.

References wfGetDB().

Referenced by getLinks().

BacklinkCache::getLinks ( table,
startId = false,
endId = false 
)

Get the backlinks for a given table.

Cached in process memory only.

Parameters:
string $table
Returns:
TitleArray

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.

Parameters:
string $table The links table name
integer $batchSize
Returns:
array

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  ) 

Set the Database object to use.

Definition at line 37 of file BacklinkCache.php.

References $db.


Member Data Documentation

BacklinkCache::$db

Definition at line 14 of file BacklinkCache.php.

Referenced by setDB().

BacklinkCache::$fullResultCache = array()

Definition at line 12 of file BacklinkCache.php.

BacklinkCache::$partitionCache = array()

Definition at line 11 of file BacklinkCache.php.

BacklinkCache::$title

Definition at line 13 of file BacklinkCache.php.

Referenced by __construct().

Definition at line 16 of file BacklinkCache.php.


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

Generated on Sat Sep 5 02:08:33 2009 for MediaWiki by  doxygen 1.5.9