optimize redis client

This commit is contained in:
ubuntu14 2015-01-27 01:52:50 -08:00
parent 4323441df7
commit 730ff1c3fb
14 changed files with 330 additions and 113 deletions

View File

@ -104,7 +104,7 @@ public:
/**
* REDIS_RESULT_STRING
*
* @param buf {string&}
* @param buf {string&} buf.clear()
* @return {size_t}
*/
size_t argv_to_string(string& buf) const;

View File

@ -27,15 +27,15 @@ public:
* -1 key
* >0
*/
int zadd(const char* key, std::map<string, double>& members);
int zadd(const char* key, const std::map<string, double>& members);
int zadd(const char* key,
std::vector<std::pair<string, double> >&members);
const std::vector<std::pair<string, double> >&members);
int zadd(const char* key,
std::vector<std::pair<const char*, double> >&members);
int zadd(const char* key, std::vector<string>& members,
std::vector<double>& scores);
int zadd(const char* key, std::vector<const char*>& members,
std::vector<double>& scores);
const std::vector<std::pair<const char*, double> >&members);
int zadd(const char* key, const std::vector<string>& members,
const std::vector<double>& scores);
int zadd(const char* key, const std::vector<const char*>& members,
const std::vector<double>& scores);
int zadd(const char* key, const char* members[], double scores[],
size_t size);
int zadd(const char* key, const char* members[], size_t members_len[],
@ -80,7 +80,8 @@ public:
* @param key {const char*}
* @param start {int}
* @param stop {int}
* @param result {std::vector<string>&}
* @param result {std::vector<string>&}
* result.clear()
* @return {int}
* 0: key
* -1: key
@ -96,7 +97,7 @@ public:
* @param key {const char*}
* @param start {int}
* @param stop {int}
* @param result "成员名-分值对"
* @param result "成员名-分值对" out.clear()
* @return {int}
* 0: key
* -1: key
@ -113,7 +114,7 @@ public:
* @param key {const char*}
* @param min {double}
* @param max {double}
* @param out -
* @param out - out.clear()
* @param offset {const int*}
* @param count {const int*}
* @return {int}
@ -132,7 +133,7 @@ public:
* @param key {const char*}
* @param min {const char*}
* @param max {const char*}
* @param out -
* @param out - out.clear()
* @param offset {const int*}
* @param count {const int*}
* @return {int}
@ -155,6 +156,8 @@ public:
* key score min max ( min max )
* score ()(min/max)使
*
* @param out out.clear()
* @return {int}
*/
int zrangebyscore_with_scores(const char* key, double min, double max,
std::vector<std::pair<string, double> >& out,
@ -164,6 +167,8 @@ public:
* key score min max ( min max )
* score ()(min/max)使
*
* @param out out.clear()
* @return {int}
*/
int zrangebyscore_with_scores(const char* key, const char* min,
const char* max, std::vector<std::pair<string, double> >& out,
@ -240,6 +245,7 @@ public:
* @param result {std::vector<string>&}
* 0 1 -1
* -2
* @return {int} -1
*/
int zrevrange(const char* key, int start, int stop,
std::vector<string>& result);
@ -249,9 +255,10 @@ public:
* @param key {const char*}
* @param start {int}
* @param stop {int}
* @param result "成员名-分值对"
* @param result "成员名-分值对" out.clear()
* 0 1 -1
* -2
* @return {int} -1
*/
int zrevrange_with_scores(const char* key, int start, int stop,
std::vector<std::pair<string, double> >& out);
@ -262,7 +269,7 @@ public:
* @param key {const char*}
* @param min {const char*}
* @param max {const char*}
* @param out -
* @param out - out.clear()
* @param offset {const int*}
* @param count {const int*}
* @return {int}
@ -285,6 +292,8 @@ public:
* key score min max ( min max )
* score ()(min/max)使
*
* @param out - out.clear()
* @param count {const int*}
*/
int zrevrangebyscore_with_scores(const char* key, double min,
double max, std::vector<std::pair<string, double> >& out,
@ -330,7 +339,7 @@ public:
* MIN: score score
* MAX: score score
* @return {int} ()
*
* -1
*/
int zunionstore(const char* dst, const std::map<string, double>& keys,
const char* aggregate = "SUM");
@ -351,6 +360,21 @@ public:
int zinterstore(const char* dst, const std::vector<string>& keys,
const std::vector<double>* weights = NULL,
const char* aggregate = "SUM");
/**
*
* @param cursor {int} 0
* @param out out.clear()
* @param pattern {const char*} glob
* @param count {const size_t*}
* @return {int}
* 0
* -1:
* >0:
*/
int zscan(const char* key, int cursor,
std::vector<std::pair<string, double> >& out,
const char* pattern = NULL, const size_t* count = NULL);
/**
*
@ -358,6 +382,7 @@ public:
* key min max
* @param min {const char*}
* @param max {const char*}
* @param out {std::map<string, double>&} out.clear()
* @param offset {const int*}
* @param count {const int*}
* @return {int}
@ -378,31 +403,17 @@ public:
/**
* key
* min max
* @return {int}
* @return {int}
*/
int zlexcount(const char* key, const char* min, const char* max);
/**
* key
* min max
* @return {int}
* @return {int}
*/
int zremrangebylex(const char* key, const char* min, const char* max);
/**
*
* @param cursor {int} 0
* @param out {std::map<string, double>&}
* @param pattern {const char*} glob
* @param count {const size_t*}
* @return {int}
* 0
* -1:
* >0:
*/
int zscan(const char* key, int cursor, std::map<string, double>& out,
const char* pattern = NULL, const size_t* count = NULL);
private:
int zrange_get(const char* cmd, const char* key, int start,
int stop, std::vector<string>& result);

View File

@ -5,6 +5,7 @@ all:
@(cd redis_pool; make)
@(cd redis_manager; make)
@(cd redis_pubsub; make)
@(cd redis_zset; make)
clean:
@(cd redis_key; make clean)
@ -13,3 +14,4 @@ clean:
@(cd redis_pool; make clean)
@(cd redis_manager; make clean)
@(cd redis_pubsub; make clean)
@(cd redis_zset; make clean)

View File

@ -120,20 +120,21 @@ static void test_zrange(acl::redis_zset& option, int n)
printf("zrange error, key: %s\r\n", key.c_str());
break;
}
else if (i < 10)
else if (i >= 10)
{
printf("zrange ok, key: %s, ret: %d\r\n",
key.c_str(), ret);
std::vector<acl::string>::const_iterator cit;
for (cit = result.begin(); cit != result.end(); ++cit)
{
if (cit != result.begin())
printf(", ");
printf("%s", (*cit).c_str());
}
printf("\r\n");
result.clear();
continue;
}
printf("zrange ok, key: %s, ret: %d\r\n", key.c_str(), ret);
std::vector<acl::string>::const_iterator cit;
for (cit = result.begin(); cit != result.end(); ++cit)
{
if (cit != result.begin())
printf(", ");
printf("%s", (*cit).c_str());
}
printf("\r\n");
result.clear();
}
@ -153,21 +154,22 @@ static void test_zrange(acl::redis_zset& option, int n)
printf("zrange error, key: %s\r\n", key.c_str());
break;
}
else if (i < 10)
else if (i >= 10)
{
printf("zrange ok, key: %s, ret: %d\r\n",
key.c_str(), ret);
std::vector<std::pair<acl::string, double> >::const_iterator cit;
for (cit = result2.begin(); cit != result2.end(); ++cit)
{
if (cit != result2.begin())
printf(", ");
printf("%s: %.2f", cit->first.c_str(), cit->second);
}
printf("\r\n");
result2.clear();
continue;
}
printf("zrange ok, key: %s, ret: %d\r\n", key.c_str(), ret);
std::vector<std::pair<acl::string, double> >::const_iterator cit;
for (cit = result2.begin(); cit != result2.end(); ++cit)
{
if (cit != result2.begin())
printf(", ");
printf("%s: %.2f", cit->first.c_str(), cit->second);
}
printf("\r\n");
result2.clear();
}
}
@ -192,20 +194,22 @@ static void test_zrangebyscore(acl::redis_zset& option, int n)
printf("zrangebyscore error, key: %s\r\n", key.c_str());
break;
}
else if (i < 10)
else if (i >= 10)
{
printf("zrangebyscore ok, key: %s, ret: %d\r\n",
key.c_str(), ret);
std::vector<acl::string>::const_iterator cit;
for (cit = result.begin(); cit != result.end(); ++cit)
{
if (cit != result.begin())
printf(", ");
printf("%s", (*cit).c_str());
}
printf("\r\n");
result.clear();
continue;
}
printf("zrangebyscore ok, key: %s, ret: %d\r\n",
key.c_str(), ret);
std::vector<acl::string>::const_iterator cit;
for (cit = result.begin(); cit != result.end(); ++cit)
{
if (cit != result.begin())
printf(", ");
printf("%s", (*cit).c_str());
}
printf("\r\n");
result.clear();
}
@ -226,22 +230,24 @@ static void test_zrangebyscore(acl::redis_zset& option, int n)
key.c_str());
break;
}
else if (i < 10)
else if (i >= 10)
{
printf("zrangebyscore_with_scores ok, key: %s, ret: %d\r\n",
key.c_str(), ret);
std::vector<std::pair<acl::string, double> >::const_iterator cit;
for (cit = result2.begin(); cit != result2.end(); ++cit)
{
if (cit != result2.begin())
printf(", ");
printf("%s: %.2f", cit->first.c_str(),
cit->second);
}
printf("\r\n");
result2.clear();
continue;
}
result.clear();
printf("zrangebyscore_with_scores ok, key: %s, ret: %d\r\n",
key.c_str(), ret);
std::vector<std::pair<acl::string, double> >::const_iterator cit;
for (cit = result2.begin(); cit != result2.end(); ++cit)
{
if (cit != result2.begin())
printf(", ");
printf("%s: %.2f", cit->first.c_str(),
cit->second);
}
printf("\r\n");
result2.clear();
}
}
@ -265,8 +271,9 @@ static void test_zrank(acl::redis_zset& option, int n)
break;
}
else if (j > 0 && j * i < 100)
printf("zrank ok, key: %s, member:%s, rank: %d\r\n",
key.c_str(), member.c_str(), ret);
printf("zrank ok, key: %s, member:%s, "
"rank: %d\r\n", key.c_str(),
member.c_str(), ret);
}
}
}
@ -315,19 +322,183 @@ static void test_zscore(acl::redis_zset& option, int n)
for (int j = 0; j < 1000; j++)
{
member.format("member_%d", j);
ret = option.zscore(key.c_str(), member.c_str(), result);
ret = option.zscore(key.c_str(), member.c_str(),
result);
if (ret == false)
{
printf("zscore error, key: %s\r\n", key.c_str());
printf("zscore error, key: %s\r\n",
key.c_str());
break;
}
else if (j > 0 && j * i < 100)
printf("zscore ok, key: %s, member:%s, score: %.2f\r\n",
key.c_str(), member.c_str(), result);
printf("zscore ok, key: %s, member:%s, "
"score: %.2f\r\n", key.c_str(),
member.c_str(), result);
}
}
}
static void test_zunionstore(acl::redis_zset& option, int n)
{
acl::string dest_key, src1_key, src2_key;
std::vector<acl::string> src_keys;
for (int i = 0; i < n; i++)
{
dest_key.format("zset_dest_key_%d", i);
src1_key.format("zset_src1_key_%d", i);
src_keys.push_back(src1_key);
src2_key.format("zset_src2_key_%d", i);
src_keys.push_back(src2_key);
int ret = option.zunionstore(dest_key.c_str(), src_keys);
if (ret < 0)
{
printf("zunionstore error, dest: %s\r\n",
dest_key.c_str());
break;
}
src_keys.clear();
}
}
static void test_zinterstore(acl::redis_zset& option ,int n)
{
acl::string dest_key, src1_key, src2_key;
std::vector<acl::string> src_keys;
for (int i = 0; i < n; i++)
{
dest_key.format("zset_dest_key_%d", i);
src1_key.format("zset_src1_key_%d", i);
src_keys.push_back(src1_key);
src2_key.format("zset_src2_key_%d", i);
src_keys.push_back(src2_key);
int ret = option.zinterstore(dest_key.c_str(), src_keys);
if (ret < 0)
{
printf("zinterstore error, dest: %s\r\n",
dest_key.c_str());
break;
}
src_keys.clear();
}
}
static void test_zscan(acl::redis_zset& option, int n)
{
acl::string key;
int ret = 0, j;
std::vector<std::pair<acl::string, double> > result;
std::vector<std::pair<acl::string, double> >::const_iterator cit;
for (int i = 0; i < n; i++)
{
key.format("%s_%d", __keypre.c_str(), i);
while (true)
{
ret = option.zscan(key.c_str(), ret, result);
if (ret < 0)
{
printf("zscan failed, key: %s\r\n",
key.c_str());
break;
}
if (ret == 0)
{
printf("zscan over, key: %s\r\n",
key.c_str());
break;
}
if (i >= 10)
continue;
j = 0;
for (cit = result.begin(); cit != result.end(); ++cit)
{
printf("%s: %.2f\r\n", cit->first.c_str(),
cit->second);
j++;
}
printf("\r\n");
}
}
}
static void test_zrangebylex(acl::redis_zset& option, int n)
{
acl::string key;
const char* min = "[aaa", *max = "(g";
std::vector<acl::string> result;
for (int i = 0; i < n; i++)
{
key.format("%s_%d", __keypre.c_str(), i);
int ret = option.zrangebylex(key.c_str(), min, max, result);
if (ret < 0)
{
printf("zrangebylex error, key: %s\r\n", key.c_str());
break;
}
if (i >= 10)
{
result.clear();
continue;
}
std::vector<acl::string>::const_iterator cit;
for (cit = result.begin(); cit != result.end(); ++cit)
{
if (cit != result.begin())
printf(", ");
printf("%s", (*cit).c_str());
}
printf("\r\n");
}
}
static void test_zlexcount(acl::redis_zset& option, int n)
{
acl::string key;
const char* min = "[aaa", *max = "(g";
for (int i = 0; i < n; i++)
{
key.format("%s_%d", __keypre.c_str(), i);
int ret = option.zlexcount(key.c_str(), min, max);
if (ret < 0)
{
printf("zlexcount error, key: %s\r\n", key.c_str());
break;
}
if (i >= 10)
continue;
printf("key: %s, count: %d\r\n", key.c_str(), ret);
}
}
static void test_zremrangebylex(acl::redis_zset& option, int n)
{
acl::string key;
const char* min = "[aaa", *max = "(g";
for (int i = 0; i < n; i++)
{
key.format("%s_%d", __keypre.c_str(), i);
int ret = option.zremrangebylex(key.c_str(), min, max);
if (ret < 0)
{
printf("zremrangebylex error, key: %s\r\n",
key.c_str());
break;
}
if (i >= 10)
continue;
printf("key: %s, count: %d\r\n", key.c_str(), ret);
}
}
static void usage(const char* procname)
{
printf("usage: %s -h[help]\r\n"
@ -391,21 +562,8 @@ int main(int argc, char* argv[])
test_zrank(option, n);
else if (cmd == "zrem")
test_zrem(option, n);
#if 0
else if (cmd == "zremrangebyrank")
test_zremrangebyrank(option, n);
else if (cmd == "zremrangebyscore")
test_zremrangebyscore(option, n);
else if (cmd == "zrevrange")
test_zrevrange(option, n);
else if (cmd == "zrevrangebyscore")
test_zrevrangebyscore(option, n);
else if (cmd == "zrevrank")
test_zrevrank(option, n);
#endif
else if (cmd == "zscore")
test_zscore(option, n);
#if 0
else if (cmd == "zunionstore")
test_zunionstore(option, n);
else if (cmd == "zinterstore")
@ -417,8 +575,7 @@ int main(int argc, char* argv[])
else if (cmd == "zlexcount")
test_zlexcount(option, n);
else if (cmd == "zremrangebylex")
test_zremrangebylex("option, n");
#endif
test_zremrangebylex(option, n);
else if (cmd == "all")
{
test_zadd(option, n);

View File

@ -407,6 +407,8 @@ long long int redis_client::get_number64(bool* success /* = NULL */)
int redis_client::get_number(std::vector<int>& out)
{
out.clear();
const redis_result* result = run();
if (result == NULL || result->get_type() != REDIS_RESULT_ARRAY)
return -1;
@ -429,6 +431,8 @@ int redis_client::get_number(std::vector<int>& out)
int redis_client::get_number64(std::vector<long long int>& out)
{
out.clear();
const redis_result* result = run();
if (result == NULL || result->get_type() != REDIS_RESULT_ARRAY)
return -1;
@ -465,6 +469,8 @@ bool redis_client::get_status(const char* success /* = "OK" */)
int redis_client::get_status(std::vector<bool>& out)
{
out.clear();
const redis_result* result = run();
if (result == NULL || result->get_type() != REDIS_RESULT_ARRAY)
return -1;
@ -520,6 +526,8 @@ int redis_client::get_string(char* buf, size_t size)
int redis_client::get_strings(std::vector<string>& out)
{
out.clear();
const redis_result* result = run();
if (result == NULL || result->get_type() != REDIS_RESULT_ARRAY)
return -1;
@ -561,6 +569,8 @@ int redis_client::get_strings(std::vector<string>* out)
if (out == NULL)
return result->get_size();
out->clear();
size_t size;
const redis_result** children = result->get_children(&size);
if (children == NULL)
@ -592,6 +602,8 @@ int redis_client::get_strings(std::vector<string>* out)
int redis_client::get_strings(std::map<string, string>& out)
{
out.clear();
const redis_result* result = run();
if (result == NULL || result->get_type() != REDIS_RESULT_ARRAY)
return -1;
@ -631,6 +643,9 @@ int redis_client::get_strings(std::map<string, string>& out)
int redis_client::get_strings(std::vector<string>& names,
std::vector<string>& values)
{
names.clear();
values.clear();
const redis_result* result = run();
if (result == NULL || result->get_type() != REDIS_RESULT_ARRAY)
return -1;
@ -673,6 +688,9 @@ int redis_client::get_strings(std::vector<string>& names,
int redis_client::get_strings(std::vector<const char*>& names,
std::vector<const char*>& values)
{
names.clear();
values.clear();
const redis_result* result = run();
if (result == NULL || result->get_type() != REDIS_RESULT_ARRAY)
return -1;
@ -780,7 +798,7 @@ void redis_client::build_request1(size_t argc, const char* argv[], size_t lens[]
request_.append(argv[i], lens[i]);
request_.append("\r\n");
}
// printf("%s", request_.c_str());
//printf("%s", request_.c_str());
}
void redis_client::build_request2(size_t argc, const char* argv[], size_t lens[])

View File

@ -91,7 +91,7 @@ const redis_result** redis_command::scan_keys(const char* cmd, const char* key,
}
conn_->build_request(argc, argv, lens);
const redis_result* result = conn_->run(2);
const redis_result* result = conn_->run();
if (result == NULL)
{
cursor = -1;
@ -110,7 +110,13 @@ const redis_result** redis_command::scan_keys(const char* cmd, const char* key,
cursor = -1;
return NULL;
}
cursor = rr->get_integer();
string tmp(128);
if (rr->argv_to_string(tmp) == 0)
{
cursor = -1;
return NULL;
}
cursor = atoi(tmp.c_str());
if (cursor < 0)
{
cursor = -1;

View File

@ -377,6 +377,7 @@ int redis_hash::hscan(const char* key, int cursor,
const redis_result* rr;
string name(128), value(128);
out.clear();
for (size_t i = 0; i < size;)
{

View File

@ -512,6 +512,8 @@ int redis_key::scan(int cursor, std::vector<string>& out,
const redis_result* rr;
string key_buf(128);
out.clear();
out.reserve(size);
for (size_t i = 0; i < size; i++)

View File

@ -70,7 +70,8 @@ bool redis_list::lset(const char* key, size_t idx, const char* value)
return lset(key, idx, value, strlen(value));
}
bool redis_list::lset(const char* key, size_t idx, const char* value, size_t len)
bool redis_list::lset(const char* key, size_t idx,
const char* value, size_t len)
{
const char* argv[4];
size_t lens[4];
@ -448,7 +449,6 @@ bool redis_list::bpop(std::pair<string, string>& out)
first->argv_to_string(buf);
out.first = buf;
buf.clear();
second->argv_to_string(buf);
out.second = buf;
return true;

View File

@ -352,6 +352,7 @@ int redis_pubsub::pubsub_numsub(std::map<string, int>& out)
string buf(128);
const redis_result* rr;
out.clear();
for (size_t i = 0; i < size;)
{

View File

@ -160,6 +160,8 @@ size_t redis_result::get_length() const
size_t redis_result::argv_to_string(string& buf) const
{
buf.clear();
if (idx_ == 0)
return 0;

View File

@ -216,6 +216,7 @@ int redis_script::eval_status(const char* cmd, const char* script,
const redis_result* rr;
const char* status;
out.clear();
for (size_t i = 0; i < size; i++)
{
@ -250,6 +251,8 @@ int redis_script::eval_number(const char* cmd, const char* script,
const redis_result* rr;
int number;
bool success;
out.clear();
status.clear();
for (size_t i = 0; i < size; i++)
{
@ -277,7 +280,9 @@ long long int redis_script::eval_number64(const char* cmd, const char* script,
if (children == NULL || size == 0)
return 0;
out.clear();
out.reserve(size);
status.clear();
const redis_result* rr;
long long int number;
@ -308,6 +313,7 @@ int redis_script::eval_strings(const char* cmd, const char* script,
if (children == NULL || size == 0)
return 0;
out.clear();
out.reserve(size);
const redis_result* rr;
@ -481,6 +487,8 @@ bool redis_script::script_flush()
bool redis_script::script_load(const string& script, string& out)
{
out.clear();
const char* argv[3];
size_t lens[3];

View File

@ -421,6 +421,8 @@ int redis_set::sscan(const char* key, int cursor, std::vector<string>& out,
const redis_result* rr;
string key_buf(128);
out.clear();
out.reserve(size);
for (size_t i = 0; i < size; i++)

View File

@ -22,7 +22,7 @@ redis_zset::~redis_zset()
}
int redis_zset::zadd(const char* key, std::map<string, double>& members)
int redis_zset::zadd(const char* key, const std::map<string, double>& members)
{
dbuf_pool* pool = conn_->get_pool();
size_t argc = 2 + members.size() * 2;
@ -58,7 +58,7 @@ int redis_zset::zadd(const char* key, std::map<string, double>& members)
}
int redis_zset::zadd(const char* key,
std::vector<std::pair<string, double> >&members)
const std::vector<std::pair<string, double> >&members)
{
dbuf_pool* pool = conn_->get_pool();
size_t argc = 2 + members.size() * 2;
@ -93,7 +93,7 @@ int redis_zset::zadd(const char* key,
}
int redis_zset::zadd(const char* key,
std::vector<std::pair<const char*, double> >&members)
const std::vector<std::pair<const char*, double> >&members)
{
dbuf_pool* pool = conn_->get_pool();
size_t argc = 2 + members.size() * 2;
@ -128,8 +128,8 @@ int redis_zset::zadd(const char* key,
return conn_->get_number();
}
int redis_zset::zadd(const char* key, std::vector<string>& members,
std::vector<double>& scores)
int redis_zset::zadd(const char* key, const std::vector<string>& members,
const std::vector<double>& scores)
{
size_t size = scores.size();
if (size != members.size())
@ -167,8 +167,8 @@ int redis_zset::zadd(const char* key, std::vector<string>& members,
return conn_->get_number();
}
int redis_zset::zadd(const char* key, std::vector<const char*>& members,
std::vector<double>& scores)
int redis_zset::zadd(const char* key, const std::vector<const char*>& members,
const std::vector<double>& scores)
{
size_t size = scores.size();
if (size != members.size())
@ -386,6 +386,8 @@ int redis_zset::zrange(const char* key, int start,
int redis_zset::zrange_get_with_scores(const char* cmd, const char* key,
int start, int stop, std::vector<std::pair<string, double> >& out)
{
out.clear();
const char* argv[5];
size_t lens[5];
@ -574,6 +576,7 @@ int redis_zset::zrangebyscore_get_with_scores(const char* cmd,
double score;
const redis_result* child;
string buf(128);
out.clear();
for (size_t i = 0; i < size; i++)
{
@ -1054,7 +1057,8 @@ int redis_zset::zremrangebylex(const char* key, const char* min, const char* max
return conn_->get_number();
}
int redis_zset::zscan(const char* key, int cursor, std::map<string, double>& out,
int redis_zset::zscan(const char* key, int cursor,
std::vector<std::pair<string, double> >& out,
const char* pattern /* = NULL */, const size_t* count /* = NULL */)
{
if (key == NULL || *key == 0 || cursor < 0)
@ -1069,6 +1073,9 @@ int redis_zset::zscan(const char* key, int cursor, std::map<string, double>& out
if (size % 2 != 0)
return -1;
out.clear();
out.reserve(size);
const redis_result* rr;
string name(128), value(128);
@ -1082,7 +1089,7 @@ int redis_zset::zscan(const char* key, int cursor, std::map<string, double>& out
rr->argv_to_string(value);
i++;
out[name] = atof(value.c_str());
out.push_back(std::make_pair(name, atof(value.c_str())));
}
return cursor;