@@ -117,13 +117,28 @@ static size_t execute_get(const client_options &opt, memcached_st &memc, const k
117
117
static size_t execute_mget (const client_options &opt, memcached_st &memc, const keyval_st &kv) {
118
118
size_t retrieved = 0 ;
119
119
memcached_execute_fn cb[] = {&counter};
120
+ memcached_return_t rc;
120
121
121
- auto rc = memcached_mget_execute (&memc, kv.key .chr .data (), kv.key .len .data (), kv.num , cb, &retrieved, 1 );
122
+ if (memcached_is_binary (&memc)) {
123
+ rc = memcached_mget_execute (&memc, kv.key .chr .data (), kv.key .len .data (), kv.num , cb,
124
+ &retrieved, 1 );
122
125
123
- while (rc != MEMCACHED_END && memcached_success (rc)) {
124
- rc = memcached_fetch_execute (&memc, cb, &retrieved, 1 );
125
- }
126
+ while (rc != MEMCACHED_END && memcached_success (rc)) {
127
+ rc = memcached_fetch_execute (&memc, cb, &retrieved, 1 );
128
+ }
129
+ } else {
130
+ memcached_result_st res;
131
+ memcached_result_create (&memc, &res);
132
+
133
+ rc = memcached_mget (&memc, kv.key .chr .data (), kv.key .len .data (), kv.num );
126
134
135
+ while (rc != MEMCACHED_END && memcached_success (rc)) {
136
+ if (memcached_fetch_result (&memc, &res, &rc)) {
137
+ ++retrieved;
138
+ }
139
+ }
140
+ memcached_result_free (&res);
141
+ }
127
142
if (memcached_fatal (rc)) {
128
143
if (!opt.isset (" quiet" )) {
129
144
std::cerr << " Failed mget: " << memcached_strerror (&memc, rc) << " : "
0 commit comments