MediaWiki  REL1_19
HTMLCacheUpdate Class Reference

Class to invalidate the HTML cache of all the pages linking to a given title. More...

Inheritance diagram for HTMLCacheUpdate:
Collaboration diagram for HTMLCacheUpdate:

List of all members.

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.

Detailed Description

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.


Constructor & Destructor Documentation

HTMLCacheUpdate::__construct ( titleTo,
table,
start = false,
end = false 
)
Parameters:
$titleTo
$table
$startbool
$endbool

Definition at line 41 of file HTMLCacheUpdate.php.

References $wgUpdateRowsPerJob, and $wgUpdateRowsPerQuery.


Member Function Documentation

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().

Here is the call graph for this function:

Here is the caller graph for this function:

Perform the actual work.

Implements DeferrableUpdate.

Definition at line 53 of file HTMLCacheUpdate.php.

References doPartialUpdate(), insertJobs(), insertJobsFromTitles(), invalidateTitles(), and wfDebug().

Here is the call graph for this function:

HTMLCacheUpdate::insertJobs ( ) [protected]
Returns:
mixed

Definition at line 149 of file HTMLCacheUpdate.php.

References Job\batchInsert().

Referenced by doUpdate().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
$titleArrayarray

Definition at line 101 of file HTMLCacheUpdate.php.

References $title, Job\batchInsert(), invalidateTitles(), and wfDebug().

Referenced by doPartialUpdate(), and doUpdate().

Here is the call graph for this function:

Here is the caller graph for this function:

HTMLCacheUpdate::invalidateTitles ( titleArray) [protected]

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

Parameters:
$titleArrayarray

Definition at line 170 of file HTMLCacheUpdate.php.

References $title, $wgUseFileCache, $wgUseSquid, HTMLFileCache\clearFileCache(), SquidUpdate\newFromTitles(), and wfGetDB().

Referenced by doPartialUpdate(), doUpdate(), and insertJobsFromTitles().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

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.


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