b7697c730bde1dc6c4b07277747f8d33d714bc50
3 * memcached diagnostic tool
7 * @subpackage Maintenance
11 require_once( "commandLine.inc" );
12 require_once("memcached-client.php");
14 $mcc = new memcached( array('persistant' => true) );
15 $mcc->set_servers( $wgMemCachedServers );
16 $mcc->set_debug( true );
21 $line = readconsole( "> " );
22 $args = explode( " ", $line );
23 $command = array_shift( $args );
26 print "Getting {$args[0]}[{$args[1]}]\n";
27 $res = $mcc->get( $args[0] );
28 if ( array_key_exists( 1, $args ) ) {
29 $res = $res[$args[1]];
31 if ( $res === false ) {
32 #print 'Error: ' . $mcc->error_string() . "\n";
33 print "MemCached error\n";
34 } elseif ( is_string( $res ) ) {
41 $res = $mcc->get( $args[0] );
42 $sock = $mcc->get_sock( $args[0] );
46 $key = array_shift( $args );
47 if ( $args[0] == "#" && is_numeric( $args[1] ) ) {
48 $value = str_repeat( "*", $args[1] );
50 $value = implode( " ", $args );
52 if ( !$mcc->set( $key, $value, 0 ) ) {
53 #print 'Error: ' . $mcc->error_string() . "\n";
54 print "MemCached error\n";
58 $key = implode( " ", $args );
59 if ( !$mcc->delete( $key ) ) {
60 #print 'Error: ' . $mcc->error_string() . "\n";
61 print "MemCached error\n";
76 print "Bad command\n";
79 if ( function_exists( "readline_add_history" ) ) {
80 readline_add_history( $line );