r22842 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22841‎ | r22842 | r22843 >
Date:15:56, 8 June 2007
Author:robchurch
Status:old
Tags:
Comment:
* (bug 10181) Support the XCache object caching mechanism [patch from Kurt Radwanski]
* Minor tweak to installer form
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/config/index.php (modified) (history)
  • /trunk/phase3/includes/AutoLoader.php (modified) (history)
  • /trunk/phase3/includes/BagOStuff.php (modified) (history)
  • /trunk/phase3/includes/ObjectCache.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/BagOStuff.php
@@ -565,6 +565,52 @@
566566 }
567567
568568 /**
 569+ * Wrapper for XCache object caching functions; identical interface
 570+ * to the APC wrapper
 571+ */
 572+class XCacheBagOStuff extends APCBagOStuff {
 573+
 574+ /**
 575+ * Get a value from the XCache object cache
 576+ *
 577+ * @param string $key Cache key
 578+ * @return mixed
 579+ */
 580+ public function get( $key ) {
 581+ $val = xcache_get( $key );
 582+ if( is_string( $val ) )
 583+ $val = unserialize( $val );
 584+ return $val;
 585+ }
 586+
 587+ /**
 588+ * Store a value in the XCache object cache
 589+ *
 590+ * @param string $key Cache key
 591+ * @param mixed $value Object to store
 592+ * @param int $expire Expiration time
 593+ * @return bool
 594+ */
 595+ public function set( $key, $value, $expire = 0 ) {
 596+ xcache_set( $key, serialize( $value ), $expire );
 597+ return true;
 598+ }
 599+
 600+ /**
 601+ * Remove a value from the XCache object cache
 602+ *
 603+ * @param string $key Cache key
 604+ * @param int $time Not used in this implementation
 605+ * @return bool
 606+ */
 607+ public function delete( $key, $time = 0 ) {
 608+ xcache_unset( $key );
 609+ return true;
 610+ }
 611+
 612+}
 613+
 614+/**
569615 * @todo document
570616 */
571617 class DBABagOStuff extends BagOStuff {
Index: trunk/phase3/includes/ObjectCache.php
@@ -70,6 +70,8 @@
7171 $wgCaches[CACHE_ACCEL] = new eAccelBagOStuff;
7272 } elseif ( function_exists( 'apc_fetch') ) {
7373 $wgCaches[CACHE_ACCEL] = new APCBagOStuff;
 74+ } elseif( function_exists( 'xcache_get' ) ) {
 75+ $wgCaches[CACHE_ACCEL] = new XCacheBagOStuff();
7476 } elseif ( function_exists( 'mmcache_get' ) ) {
7577 $wgCaches[CACHE_ACCEL] = new TurckBagOStuff;
7678 } else {
Index: trunk/phase3/includes/AutoLoader.php
@@ -22,6 +22,7 @@
2323 'TurckBagOStuff' => 'includes/BagOStuff.php',
2424 'APCBagOStuff' => 'includes/BagOStuff.php',
2525 'eAccelBagOStuff' => 'includes/BagOStuff.php',
 26+ 'XCacheBagOStuff' => 'includes/BagOStuff.php',
2627 'DBABagOStuff' => 'includes/BagOStuff.php',
2728 'Block' => 'includes/Block.php',
2829 'HTMLFileCache' => 'includes/HTMLFileCache.php',
Index: trunk/phase3/config/index.php
@@ -450,6 +450,10 @@
451451 print "<li><a href=\"http://turck-mmcache.sourceforge.net/\">Turck MMCache</a> installed</li>\n";
452452 }
453453
 454+$conf->xcache = function_exists( 'xcache_get' );
 455+if( $conf->xcache )
 456+ print "<li><a href=\"http://trac.lighttpd.net/xcache/\">XCache</a> installed</li>";
 457+
454458 $conf->apc = function_exists('apc_fetch');
455459 if ($conf->apc ) {
456460 print "<li><a href=\"http://www.php.net/apc\">APC</a> installed</li>";
@@ -461,10 +465,11 @@
462466 print "<li><a href=\"http://eaccelerator.sourceforge.net/\">eAccelerator</a> installed</li>\n";
463467 }
464468
465 -if( !$conf->turck && !$conf->eaccel && !$conf->apc ) {
 469+if( !( $conf->turck || $conf->eaccel || $conf->apc || $conf->xcache ) ) {
466470 echo( '<li>Couldn\'t find <a href="http://turck-mmcache.sourceforge.net">Turck MMCache</a>,
467 - <a href="http://eaccelerator.sourceforge.net">eAccelerator</a>, or
468 - <a href="http://www.php.net/apc">APC</a>. Object caching functions cannot be used.</li>' );
 471+ <a href="http://eaccelerator.sourceforge.net">eAccelerator</a>,
 472+ <a href="http://www.php.net/apc">APC</a> or <a href="http://trac.lighttpd.net/xcache/">XCache</a>.
 473+ Object caching functions cannot be used.</li>' );
469474 }
470475
471476 $conf->diff3 = false;
@@ -1128,8 +1133,7 @@
11291134 <p class="config-desc">
11301135 An admin can lock/delete pages, block users from editing, and do other maintenance tasks.<br />
11311136 A new account will be added only when creating a new wiki database.
1132 - </p>
1133 - <p class="config-desc">
 1137+ <br /><br />
11341138 The password cannot be the same as the username.
11351139 </p>
11361140
@@ -1144,6 +1148,11 @@
11451149 aField( $conf, "Shm", "Turck MMCache", "radio", "turck" );
11461150 echo "</li>";
11471151 }
 1152+ if( $conf->xcache ) {
 1153+ echo( '<li>' );
 1154+ aField( $conf, 'Shm', 'XCache', 'radio', 'xcache' );
 1155+ echo( '</li>' );
 1156+ }
11481157 if ( $conf->apc ) {
11491158 echo "<li>";
11501159 aField( $conf, "Shm", "APC", "radio", "apc" );
@@ -1160,10 +1169,11 @@
11611170 <div style="clear:left"><?php aField( $conf, "MCServers", "Memcached servers:", "text" ) ?></div>
11621171 </div>
11631172 <p class="config-desc">
1164 - Using a shared memory system such as Turck MMCache, APC, eAccelerator, or Memcached
1165 - will speed up MediaWiki significantly. Memcached is the best solution but needs to be
1166 - installed. Specify the server addresses and ports in a comma-separated list. Only
1167 - use Turck shared memory if the wiki will be running on a single Apache server.
 1173+ An object caching system such as memcached will provide a significant performance boost,
 1174+ but needs to be installed. Provide the server addresses and ports in a comma-separated list.
 1175+ <br /><br />
 1176+ MediaWiki can also detect and support eAccelerator, Turck MMCache, APC, and XCache, but
 1177+ these should not be used if the wiki will be running on multiple application servers.
11681178 </p>
11691179 </div>
11701180
@@ -1395,6 +1405,7 @@
13961406 $mcservers = var_export( $conf->MCServerArray, true );
13971407 break;
13981408 case 'turck':
 1409+ case 'xcache':
13991410 case 'apc':
14001411 case 'eaccel':
14011412 $cacheType = 'CACHE_ACCEL';
Index: trunk/phase3/RELEASE-NOTES
@@ -69,6 +69,7 @@
7070 * (bug 8760) Allow wiki links in "protectexpiry" message
7171 * (bug 5908) Add "DEFAULTSORTKEY" and "DEFAULTCATEGORYSORT" aliases for
7272 "DEFAULTSORT" magic word
 73+* (bug 10181) Support the XCache object caching mechanism
7374
7475 == Bugfixes since 1.10 ==
7576

Follow-up revisions

RevisionCommit summaryAuthorDate
r22857Merged revisions 22811-22855 via svnmerge from...david00:48, 9 June 2007

Status & tagging log