diff options
Diffstat (limited to 'includes/ExternalStoreDB.php')
-rw-r--r-- | includes/ExternalStoreDB.php | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/includes/ExternalStoreDB.php b/includes/ExternalStoreDB.php index 769c64da..877277a2 100644 --- a/includes/ExternalStoreDB.php +++ b/includes/ExternalStoreDB.php @@ -1,26 +1,6 @@ <?php /** - * External database storage will use one (or more) separate connection pools - * from what the main wiki uses. If we load many revisions, such as when doing - * bulk backups or maintenance, we want to keep them around over the lifetime - * of the script. - * - * Associative array of LoadBalancer objects, indexed by cluster name. - */ -global $wgExternalLoadBalancers; -$wgExternalLoadBalancers = array(); - -/** - * One-step cache variable to hold base blobs; operations that - * pull multiple revisions may often pull multiple times from - * the same blob. By keeping the last-used one open, we avoid - * redundant unserialization and decompression overhead. - */ -global $wgExternalBlobCache; -$wgExternalBlobCache = array(); - -/** * DB accessable external objects * @ingroup ExternalStorage */ @@ -113,11 +93,18 @@ class ExternalStoreDB { * @private */ function &fetchBlob( $cluster, $id, $itemID ) { - global $wgExternalBlobCache; + /** + * One-step cache variable to hold base blobs; operations that + * pull multiple revisions may often pull multiple times from + * the same blob. By keeping the last-used one open, we avoid + * redundant unserialization and decompression overhead. + */ + static $externalBlobCache = array(); + $cacheID = ( $itemID === false ) ? "$cluster/$id" : "$cluster/$id/"; - if( isset( $wgExternalBlobCache[$cacheID] ) ) { + if( isset( $externalBlobCache[$cacheID] ) ) { wfDebug( "ExternalStoreDB::fetchBlob cache hit on $cacheID\n" ); - return $wgExternalBlobCache[$cacheID]; + return $externalBlobCache[$cacheID]; } wfDebug( "ExternalStoreDB::fetchBlob cache miss on $cacheID\n" ); @@ -138,7 +125,7 @@ class ExternalStoreDB { $ret = unserialize( $ret ); } - $wgExternalBlobCache = array( $cacheID => &$ret ); + $externalBlobCache = array( $cacheID => &$ret ); return $ret; } |