From f814d27dfe8004d3620676e22cf56ef8dca53bae Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Mon, 20 Oct 2003 13:41:43 +0000 Subject: [PATCH] MemCached command line client --- maintenance/mcc.php | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 maintenance/mcc.php diff --git a/maintenance/mcc.php b/maintenance/mcc.php new file mode 100755 index 0000000000..5bf56da6d4 --- /dev/null +++ b/maintenance/mcc.php @@ -0,0 +1,47 @@ +set_servers( $wgMemCachedServers ); + +do { + $bad = false; + $quit = false; + $line = readline( "> " ); + $args = explode( " ", $line ); + $command = array_shift( $args ); + switch ( $command ) { + case "get": + $res = $mcc->get( implode( " ", $args ) ); + if ( $res === false ) { + print 'Error: ' . $mcc->error_string() . "\n"; + } elseif ( is_string( $res ) ) { + print "$res\n"; + } else { + var_dump( $res ); + } + break; + case "set": + $key = array_shift( $args ); + if ( !$mcc->set( $key, implode( " ", $args ), 0 ) ) { + print 'Error: ' . $mcc->error_string() . "\n"; + } + break; + case "quit": + $quit = true; + break; + default: + $bad = true; + } + if ( $bad ) { + if ( $command ) { + print "Bad command\n"; + } + } else { + readline_add_history( $line ); + } +} while ( !$quit ); +?> + -- 2.20.1