- *buffer_ptr= ' ';
- buffer_ptr++;
- memcpy(buffer_ptr, keys[x], key_length[x]);
- buffer_ptr+= key_length[x];
+ unsigned int server_key;
+
+ server_key= memcached_generate_hash(keys[x], key_length[x]) % ptr->number_of_hosts;
+
+ if (cursor_key_exec[server_key])
+ {
+ memcached_string_st *string= cursor_key_exec[server_key];
+
+ memcached_string_append_character(ptr, string, ' ');
+ memcached_string_append(ptr, string, keys[x], key_length[x]);
+ }
+ else
+ {
+ memcached_string_st *string= memcached_string_create(ptr, SMALL_STRING_LEN);
+
+ /* We need to figure out the correct way to error in case of this failure */
+ if (!string)
+ assert(0);
+
+ memcached_string_append(ptr, string, "get ", 4);
+ memcached_string_append(ptr, string, keys[x], key_length[x]);
+
+ cursor_key_exec[server_key]= string;
+ }