- return memcached_mget(&memc, keys, key_length, number_of_keys);
+ std::vector<std::string>::iterator it= keys.begin();
+
+ while (it != keys.end())
+ {
+ real_keys.push_back(const_cast<char *>((*it).c_str()));
+ key_len.push_back((*it).length());
+ ++it;
+ }
+
+ /*
+ * If the std::vector of keys is empty then we cannot
+ * call memcached_mget as we will get undefined behavior.
+ */
+ if (!real_keys.empty())
+ {
+ memcached_return rc= memcached_mget(&memc, &real_keys[0], &key_len[0],
+ static_cast<unsigned int>(real_keys.size()));
+ return (rc == MEMCACHED_SUCCESS);
+ }
+
+ return false;