protected function initInstances()
    {
        if (empty($this->instances)) {
            foreach ($this->servers as $server) {
                if ($server instanceof \Redis) {
                    if ($server->isConnected()) {
                        $redis = $server;
                    } else {
                        throw new \InvalidArgumentException("If you use \\Redis objects as argument, the object must be connected.");
                    }
                } else {
                    if (empty($server[0])) {
                        throw new \InvalidArgumentException("A server hostname or IP is required");
                    }

                    if (empty($server[1])) {
                        $server[1] = 6379;
                    }
                    if (empty($server[2])) {
                        $server[2] = 0;
                    }
                    list($host, $port, $timeout) = $server;
                    $redis = new \Redis();
                    $redis->connect($host, $port, $timeout);
                }
                $this->instances[] = $redis;
            }
        }
    }
protected function initInstances()
    {
        if (empty($this->instances)) {
            foreach ($this->servers as $server) {
                if ($server instanceof \Redis) {
                    if ($server->isConnected()) {
                        $redis = $server;
                    } else {
                        throw new \InvalidArgumentException("If you use \\Redis objects as argument, the object must be connected.");
                    }
                } else {
                    if (empty($server[0])) {
                        throw new \InvalidArgumentException("A server hostname or IP is required");
                    }

                    if (empty($server[1])) {
                        $server[1] = 6379;
                    }
                    if (empty($server[2])) {
                        $server[2] = 0;
                    }
                    list($host, $port, $timeout) = $server;
                    $redis = new \Redis();
                    $redis->connect($host, $port, $timeout);
                }
                $this->instances[] = $redis;
            }
        }
    }
protected function initInstances ( ) { if ( empty ( $ this -> instances ) ) { foreach ( $ this -> servers as $ server ) { if ( $ server instanceof \ Redis ) { if ( $ server -> isConnected ( ) ) { $ redis = $ server ; } else { throw new \ InvalidArgumentException ( "If you use \\Redis objects as argument, the object must be connected." ) ; } } else { if ( empty ( $ server [ 0 ] ) ) { throw new \ InvalidArgumentException ( "A server hostname or IP is required" ) ; } if ( empty ( $ server [ 1 ] ) ) { $ server [ 1 ] = 6379 ; } if ( empty ( $ server [ 2 ] ) ) { $ server [ 2 ] = 0 ; } list ( $ host , $ port , $ timeout ) = $ server ; $ redis = new \ Redis ( ) ; $ redis -> connect ( $ host , $ port , $ timeout ) ; } $ this -> instances [ ] = $ redis ; } } }
Create the Redis connections
Create the Redis connections