MediaWiki  REL1_22
HTMLCacheUpdateJob Class Reference

Job wrapper for HTMLCacheUpdate. More...

Inheritance diagram for HTMLCacheUpdateJob:
Collaboration diagram for HTMLCacheUpdateJob:

List of all members.

Public Member Functions

 __construct ($title, $params, $id=0)
 Construct a job.
 run ()
 Run the job.

Public Attributes

 $rowsPerQuery

Protected Member Functions

 doFullUpdate ()
 Update all of the backlinks.
 doPartialUpdate ()
 Update some of the backlinks, defined by a page ID range.
 insertJobsFromTitles ($titleArray, $rootJobParams=array())
 Partition the current range given by $this->params['start'] and $this->params['end'], using a pre-calculated title array which gives the links in that range.
 insertPartitionJobs ($rootJobParams=array())
 invalidateTitles ($titleArray)
 Invalidate an array (or iterator) of Title objects, right now.

Protected Attributes

BacklinkCache $blCache
 *
 $rowsPerJob

Detailed Description

Job wrapper for HTMLCacheUpdate.

Gets run whenever a related job gets called from the queue.

This class is designed to work efficiently with small numbers of links, and to work reasonably well with up to ~10^5 links. Above ~10^6 links, the memory and time requirements of loading all backlinked IDs in doUpdate() might become prohibitive. The requirements measured at Wikimedia are approximately:

memory: 48 bytes per row time: 16us per row for the query plus processing

The reason this query is done is to support partitioning of the job by backlinked ID. The memory issue could be allieviated by doing this query in batches, but of course LIMIT with an offset is inefficient on the DB side.

The class is nevertheless a vast improvement on the previous method of using File::getLinksTo() and Title::touchArray(), which uses about 2KB of memory per link.

Definition at line 46 of file HTMLCacheUpdateJob.php.


Constructor & Destructor Documentation

HTMLCacheUpdateJob::__construct ( title,
params,
id = 0 
)

Construct a job.

Parameters:
$titleTitle: the title linked to
array$paramsjob parameters (table, start and end page_ids)
$idInteger: job id

Definition at line 57 of file HTMLCacheUpdateJob.php.


Member Function Documentation

Update all of the backlinks.

Definition at line 80 of file HTMLCacheUpdateJob.php.

Referenced by run().

Update some of the backlinks, defined by a page ID range.

Definition at line 113 of file HTMLCacheUpdateJob.php.

Referenced by run().

HTMLCacheUpdateJob::insertJobsFromTitles ( titleArray,
rootJobParams = array() 
) [protected]

Partition the current range given by $this->params['start'] and $this->params['end'], using a pre-calculated title array which gives the links in that range.

Queue the resulting jobs.

Parameters:
$titleArrayarray
$rootJobParamsarray
Returns:
void

Definition at line 137 of file HTMLCacheUpdateJob.php.

HTMLCacheUpdateJob::insertPartitionJobs ( rootJobParams = array()) [protected]
Parameters:
$rootJobParamsarray
Returns:
void

Definition at line 189 of file HTMLCacheUpdateJob.php.

HTMLCacheUpdateJob::invalidateTitles ( titleArray) [protected]

Invalidate an array (or iterator) of Title objects, right now.

Parameters:
$titleArrayarray

Definition at line 217 of file HTMLCacheUpdateJob.php.

Run the job.

Returns:
boolean success

Reimplemented from Job.

Definition at line 67 of file HTMLCacheUpdateJob.php.

References doFullUpdate(), doPartialUpdate(), and params.


Member Data Documentation

BacklinkCache HTMLCacheUpdateJob::$blCache [protected]

*

Definition at line 47 of file HTMLCacheUpdateJob.php.

HTMLCacheUpdateJob::$rowsPerJob [protected]

Definition at line 49 of file HTMLCacheUpdateJob.php.

HTMLCacheUpdateJob::$rowsPerQuery

Definition at line 49 of file HTMLCacheUpdateJob.php.


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