/**
* memcached diagnostic tool
*
+ * @file
* @todo document
- * @package MediaWiki
- * @subpackage Maintenance
+ * @ingroup Maintenance
*/
/** */
require_once( 'commandLine.inc' );
-require_once( 'memcached-client.php' );
$mcc = new memcached( array('persistant' => true/*, 'debug' => true*/) );
$mcc->set_servers( $wgMemCachedServers );
$line = readconsole( '> ' );
if ($line === false) exit;
-
+
$args = explode( ' ', $line );
$command = array_shift( $args );
case 'server':
$res = $mcc->get( $args[0] );
- print $mcc->_buckets[$mcc->_hashfunc( $args[0] ) % $mcc->_bucketcount] . "\n";
+ $hv = $mcc->_hashfunc( $args[0] );
+ for ( $i = 0; $i < 3; $i++ ) {
+ print $mcc->_buckets[$hv % $mcc->_bucketcount] . "\n";
+ $hv += $mcc->_hashfunc( $i . $args[0] );
+ }
break;
case 'set':
case 'history':
if ( function_exists( 'readline_list_history' ) ) {
- print_r(readline_list_history());
+ foreach( readline_list_history() as $num => $line) {
+ print "$num: $line\n";
+ }
} else {
print "readline_list_history() not available\n";
}
}
} while ( !$quit );
-?>
+