public function onOneRandomServer()
    {
        $keys = array_keys($this->getServerConfig());

        do {
            $randServerRank = array_rand($keys);
            if ($redis = $this->getRedisFromServerConfig($keys[$randServerRank])) {
                $this->selectedRedis = array($keys[$randServerRank] => $redis);
            } else {
                unset($keys[$randServerRank]);
            }
        } while (!empty($keys) && empty($this->selectedRedis));

        if (empty($this->selectedRedis)) {
            throw new Exception("Can't connect to a random redis server");
        }

        $this->multiRedis = false;

        return $this;
    }
public function onOneRandomServer()
    {
        $keys = array_keys($this->getServerConfig());

        do {
            $randServerRank = array_rand($keys);
            if ($redis = $this->getRedisFromServerConfig($keys[$randServerRank])) {
                $this->selectedRedis = array($keys[$randServerRank] => $redis);
            } else {
                unset($keys[$randServerRank]);
            }
        } while (!empty($keys) && empty($this->selectedRedis));

        if (empty($this->selectedRedis)) {
            throw new Exception("Can't connect to a random redis server");
        }

        $this->multiRedis = false;

        return $this;
    }
public function onOneRandomServer ( ) { $ keys = array_keys ( $ this -> getServerConfig ( ) ) ; do { $ randServerRank = array_rand ( $ keys ) ; if ( $ redis = $ this -> getRedisFromServerConfig ( $ keys [ $ randServerRank ] ) ) { $ this -> selectedRedis = array ( $ keys [ $ randServerRank ] => $ redis ) ; } else { unset ( $ keys [ $ randServerRank ] ) ; } } while ( ! empty ( $ keys ) && empty ( $ this -> selectedRedis ) ) ; if ( empty ( $ this -> selectedRedis ) ) { throw new Exception ( "Can't connect to a random redis server" ) ; } $ this -> multiRedis = false ; return $ this ; }
select one random server

@throws Exception
@return $this
select one random server