: count{cnt}
, proto{move(serv)}
{
- if (count < 4) {
- count = stoi(getenv_else("MEMCACHED_CLUSTER", "4"));
- }
if (!count) {
count = 1;
}
}
}
-Cluster::Cluster(vector<Server> servers)
-: count{servers.size()}
-, cluster{move(servers)}
-{
-
-}
-
Cluster::~Cluster() {
stop();
wait();
class Cluster {
public:
- explicit Cluster(Server serv, uint16_t cnt = 0);
- explicit Cluster(vector<Server> servers);
+ explicit Cluster(Server serv, uint16_t cnt = 3);
~Cluster();
Cluster(const Cluster &c) = delete;
}
SECTION("dead servers") {
- MemcachedCluster test{Cluster{vector<Server>{Server{MEMCACHED_BINARY, {"-p", random_port_string("-p")}}}}};
+ MemcachedCluster test{Cluster{Server{MEMCACHED_BINARY, {"-p", random_port_string("-p")}}, 1}};
auto memc = &test.memc;
REQUIRE_SUCCESS(memcached_set(memc, S("foo"), nullptr, 0, 0, 0));