HTMLCacheUpdate Class Reference
[Cache]

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

List of all members.

Public Member Functions

 __construct ($titleTo, $table, $start=false, $end=false)
 doUpdate ()
 invalidate ($startId=false, $endId=false)
 Invalidate a range of pages, right now.

Public Attributes

 $mTitle
 $mTable
 $mPrefix
 $mStart
 $mEnd
 $mRowsPerJob
 $mRowsPerQuery

Protected Member Functions

 doPartialUpdate ()
 Update some of the backlinks, defined by a page ID range.
 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.
 insertJobs ()
 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 Image::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 
)

Definition at line 31 of file HTMLCacheUpdate.php.

References $wgUpdateRowsPerJob, and $wgUpdateRowsPerQuery.


Member Function Documentation

HTMLCacheUpdate::doPartialUpdate (  )  [protected]

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

Definition at line 72 of file HTMLCacheUpdate.php.

References insertJobsFromTitles(), and invalidateTitles().

Referenced by doUpdate().

HTMLCacheUpdate::doUpdate (  ) 

HTMLCacheUpdate::insertJobs (  )  [protected]

Definition at line 135 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.

Definition at line 90 of file HTMLCacheUpdate.php.

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

Referenced by doPartialUpdate(), and doUpdate().

HTMLCacheUpdate::invalidate ( startId = false,
endId = false 
)

Invalidate a range of pages, right now.

Deprecated:

Definition at line 156 of file HTMLCacheUpdate.php.

References $endId, $startId, and invalidateTitles().

HTMLCacheUpdate::invalidateTitles ( titleArray  )  [protected]

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

Definition at line 164 of file HTMLCacheUpdate.php.

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

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


Member Data Documentation

HTMLCacheUpdate::$mEnd

Definition at line 28 of file HTMLCacheUpdate.php.

HTMLCacheUpdate::$mPrefix

Definition at line 28 of file HTMLCacheUpdate.php.

HTMLCacheUpdate::$mRowsPerJob

Definition at line 29 of file HTMLCacheUpdate.php.

HTMLCacheUpdate::$mRowsPerQuery

Definition at line 29 of file HTMLCacheUpdate.php.

HTMLCacheUpdate::$mStart

Definition at line 28 of file HTMLCacheUpdate.php.

HTMLCacheUpdate::$mTable

Definition at line 28 of file HTMLCacheUpdate.php.

HTMLCacheUpdate::$mTitle

Definition at line 28 of file HTMLCacheUpdate.php.


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

Generated on Sat Apr 30 22:57:39 2011 for MediaWiki by  doxygen 1.5.9