Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Using setOption on redis array causes immediate connection #504

Closed
@denveloper

Description

@denveloper
     $options = [
        'retry_interval' => 10,
        'connect_timeout' => 2,
        'lazy_connect' => true,
    ];       

$servers = ["validserver:6379", "invaliddnsname:6379"];
$this->redisArray = new RedisArray($servers, $options);

$this->redisArray->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP); <- redisarray will try to connect here

why this is bad. I setup everything as lazy in class constructor and expect to catch exceptions only when required server will be called. E.g. if I comment out this line and do call set that will land on "validserver" nothing bad will happen.

Is there reason for such behavior?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions