@@ -117,13 +117,28 @@ static size_t execute_get(const client_options &opt, memcached_st &memc, const k
117117static size_t execute_mget (const client_options &opt, memcached_st &memc, const keyval_st &kv) {
118118 size_t retrieved = 0 ;
119119 memcached_execute_fn cb[] = {&counter};
120+ memcached_return_t rc;
120121
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 );
122125
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 );
126134
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+ }
127142 if (memcached_fatal (rc)) {
128143 if (!opt.isset (" quiet" )) {
129144 std::cerr << " Failed mget: " << memcached_strerror (&memc, rc) << " : "
0 commit comments