MediaWiki
REL1_19
|
Class to invalidate the HTML cache of all the pages linking to a given title. More...
Public Member Functions | |
__construct ($titleTo, $table, $start=false, $end=false) | |
doUpdate () | |
Perform the actual work. | |
Public Attributes | |
$mEnd | |
$mPrefix | |
$mRowsPerJob | |
$mRowsPerQuery | |
$mStart | |
$mTable | |
$mTitle | |
Protected Member Functions | |
doPartialUpdate () | |
Update some of the backlinks, defined by a page ID range. | |
insertJobs () | |
insertJobsFromTitles ($titleArray) | |
Partition the current range given by $this->mStart and $this->mEnd, using a pre-calculated title array which gives the links in that range. | |
invalidateTitles ($titleArray) | |
Invalidate an array (or iterator) of Title objects, right now. |
Class to invalidate the HTML cache of all the pages linking to a given title.
Small numbers of links will be done immediately, large numbers are pushed onto the job 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 26 of file HTMLCacheUpdate.php.
HTMLCacheUpdate::__construct | ( | $ | titleTo, |
$ | table, | ||
$ | start = false , |
||
$ | end = false |
||
) |
$titleTo | |
$table | |
$start | bool |
$end | bool |
Definition at line 41 of file HTMLCacheUpdate.php.
References $wgUpdateRowsPerJob, and $wgUpdateRowsPerQuery.
HTMLCacheUpdate::doPartialUpdate | ( | ) | [protected] |
Update some of the backlinks, defined by a page ID range.
Definition at line 81 of file HTMLCacheUpdate.php.
References insertJobsFromTitles(), and invalidateTitles().
Referenced by doUpdate().
Perform the actual work.
Implements DeferrableUpdate.
Definition at line 53 of file HTMLCacheUpdate.php.
References doPartialUpdate(), insertJobs(), insertJobsFromTitles(), invalidateTitles(), and wfDebug().
HTMLCacheUpdate::insertJobs | ( | ) | [protected] |
Definition at line 149 of file HTMLCacheUpdate.php.
References Job\batchInsert().
Referenced by doUpdate().
HTMLCacheUpdate::insertJobsFromTitles | ( | $ | titleArray | ) | [protected] |
Partition the current range given by $this->mStart and $this->mEnd, using a pre-calculated title array which gives the links in that range.
Queue the resulting jobs.
$titleArray | array |
Definition at line 101 of file HTMLCacheUpdate.php.
References $title, Job\batchInsert(), invalidateTitles(), and wfDebug().
Referenced by doPartialUpdate(), and doUpdate().
HTMLCacheUpdate::invalidateTitles | ( | $ | titleArray | ) | [protected] |
Invalidate an array (or iterator) of Title objects, right now.
$titleArray | array |
Definition at line 170 of file HTMLCacheUpdate.php.
References $title, $wgUseFileCache, $wgUseSquid, HTMLFileCache\clearFileCache(), SquidUpdate\newFromTitles(), and wfGetDB().
Referenced by doPartialUpdate(), doUpdate(), and insertJobsFromTitles().
HTMLCacheUpdate::$mEnd |
Definition at line 32 of file HTMLCacheUpdate.php.
HTMLCacheUpdate::$mPrefix |
Definition at line 32 of file HTMLCacheUpdate.php.
HTMLCacheUpdate::$mRowsPerJob |
Definition at line 33 of file HTMLCacheUpdate.php.
HTMLCacheUpdate::$mRowsPerQuery |
Definition at line 33 of file HTMLCacheUpdate.php.
HTMLCacheUpdate::$mStart |
Definition at line 32 of file HTMLCacheUpdate.php.
HTMLCacheUpdate::$mTable |
Definition at line 32 of file HTMLCacheUpdate.php.
HTMLCacheUpdate::$mTitle |
Definition at line 30 of file HTMLCacheUpdate.php.