swoole_redis->connect

���ӵ�Redis������

����ԭ��

function swoole_redis->connect(string $host, int $port, callable $callback);

�ص�����

function onConnect(swoole_redis $redis, bool $result);

���ӳɹ���Ϳ���ִ��Redisָ���ˡ�

ʹ��ʾ��

$client = new swoole_redis;
$client->connect('127.0.0.1', 6379, function (swoole_redis $client, $result) {
    if ($result === false) {
        echo "connect to redis server failed.\n"
        return;
    }
    $client->set('key', 'swoole', function (swoole_redis $client, $result) {
        var_dump($result);
    });
});