} } // }}} // {{{ function help() function help() { echo 'php ./' . basename(__FILE__) . " [i|r]\n"; echo <<<HELP i insert data into redis r multi-process get data from redis HELP; } // }}} $daemon = new Daemon(); $daemon->set_options(['func' => 'get_queue', 'fork_num' => 10]); if (isset($argv[1])) { if ('i' === $argv[1]) { // insert redis $t1 = microtime(true); set_queue(10000); $t2 = microtime(true); echo 'eclipse: ' . ($t2 - $t1) . "\n"; } elseif ('r' === $argv[1]) { // run multi-process $daemon->fork_proc(); } elseif ('k' === $argv[1]) { // kill multi-process $daemon->kill_proc(); } else { help();