connect, open
Description
Connects to a Redis instance.
连接到一个Redis实例
Parameters
host: string. can be a host, or the path to a unix domain socket
host:字符串类型 可以使一个HOST IP或者是一个UNIX DOMAIN SOCKET的路径
port: int, optional
port:整数型,Redis的运行端口
timeout: float, value in seconds (optional, default is 0 meaning unlimited)
timeout:浮点型,连接的市场,单位是秒,默认为0即连接没有时间限制
Return Value
BOOL: TRUE
on success, FALSE
on error.
Example
$redis->connect('127.0.0.1', 6379); $redis->connect('127.0.0.1'); // port 6379 by default $redis->connect('127.0.0.1', 6379, 2.5); // 2.5 sec timeout. $redis->connect('/tmp/redis.sock'); // unix domain socket.