-/** */
-require_once( __DIR__ . '/commandLine.inc' );
-
-$mcc = new MWMemcached( array( 'persistent' => true ) );
-
-if ( $wgMainCacheType === CACHE_MEMCACHED ) {
+$optionsWithArgs = [ 'cache' ];
+$optionsWithoutArgs = [
+ 'debug', 'help'
+];
+require_once __DIR__ . '/commandLine.inc';
+
+$debug = isset( $options['debug'] );
+$help = isset( $options['help'] );
+$cache = isset( $options['cache'] ) ? $options['cache'] : null;
+
+if ( $help ) {
+ mccShowUsage();
+ exit( 0 );
+}
+$mcc = new MemcachedClient( [
+ 'persistent' => true,
+ 'debug' => $debug,
+] );
+
+if ( $cache ) {
+ if ( !isset( $wgObjectCaches[$cache] ) ) {
+ print "MediaWiki isn't configured with a cache named '$cache'";
+ exit( 1 );
+ }
+ $servers = $wgObjectCaches[$cache]['servers'];
+} elseif ( $wgMainCacheType === CACHE_MEMCACHED ) {