r78826 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78825‎ | r78826 | r78827 >
Date:20:43, 22 December 2010
Author:reedy
Status:ok
Tags:
Comment:
Minor followup to r78822, locally cache the cachedTimestamp so we don't have to do duplicate db calls for the same information
Modified paths:
  • /trunk/phase3/includes/QueryPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/QueryPage.php
@@ -85,6 +85,8 @@
8686 */
8787 protected $numRows;
8888
 89+ protected $cachedTimestamp = null;
 90+
8991 /**
9092 * Wheter to show prev/next links
9193 */
@@ -416,9 +418,13 @@
417419 }
418420
419421 public function getCachedTimestamp() {
420 - $dbr = wfGetDB( DB_SLAVE );
421 - $fname = get_class( $this ) . '::getCachedTimestamp';
422 - return $dbr->selectField( 'querycache_info', 'qci_timestamp', array( 'qci_type' => $this->getName() ), $fname );
 422+ if ( !is_null( $this->cachedTimestamp ) ) {
 423+ $dbr = wfGetDB( DB_SLAVE );
 424+ $fname = get_class( $this ) . '::getCachedTimestamp';
 425+ $this->cachedTimestamp = $dbr->selectField( 'querycache_info', 'qci_timestamp',
 426+ array( 'qci_type' => $this->getName() ), $fname );
 427+ }
 428+ return $this->cachedTimestamp;
423429 }
424430
425431 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r78822Refactor the retrieval of the cache timestamp into getCachedTimestamp() so th...catrope20:31, 22 December 2010

Status & tagging log