public function setRedis(?RedisClient $redis = null)
    {
        if (! $redis) {
            $server = Arr::get($this->config, 'server', []);
            $options = Arr::get($this->config, 'options', []);

            // forbid setting prefix from options
            if (Arr::has($options, 'prefix')) {
                $options = Arr::except($options, 'prefix');
            }

            $redis = new RedisClient($server, $options);
        }

        $this->redis = $redis;
    }
public function setRedis(?RedisClient $redis = null)
    {
        if (! $redis) {
            $server = Arr::get($this->config, 'server', []);
            $options = Arr::get($this->config, 'options', []);

            // forbid setting prefix from options
            if (Arr::has($options, 'prefix')) {
                $options = Arr::except($options, 'prefix');
            }

            $redis = new RedisClient($server, $options);
        }

        $this->redis = $redis;
    }
public function setRedis ( ? RedisClient $ redis = null ) { if ( ! $ redis ) { $ server = Arr :: get ( $ this -> config , 'server' , [ ] ) ; $ options = Arr :: get ( $ this -> config , 'options' , [ ] ) ; // forbid setting prefix from options if ( Arr :: has ( $ options , 'prefix' ) ) { $ options = Arr :: except ( $ options , 'prefix' ) ; } $ redis = new RedisClient ( $ server , $ options ) ; } $ this -> redis = $ redis ; }
Set redis client.

@param \Predis\Client|null $redis
Set redis client .