public function __construct($host = '127.0.0.1', $port = 6379, $database = 0, $prefix = 'simple-fork')
{
$this->redis = new \Redis();
$connection_result = $this->redis->connect($host, $port);
if (!$connection_result) {
throw new \RuntimeException('can not connect to the redis server');
}
if ($database != 0) {
$select_result = $this->redis->select($database);
if (!$select_result) {
throw new \RuntimeException('can not select the database');
}
}
if (empty($prefix)) {
throw new \InvalidArgumentException('prefix can not be empty');
}
$this->prefix = $prefix;
}