-#include <memcached.h>
+#include "common.h"
static char *memcached_value_fetch(memcached_st *ptr, char *key, size_t *key_length,
size_t *value_length,
assert(flags);
assert(error);
+ memset(buffer, 0, MEMCACHED_DEFAULT_COMMAND_SIZE);
end_ptr= buffer + MEMCACHED_DEFAULT_COMMAND_SIZE;
*value_length= 0;
- memset(buffer, 0, MEMCACHED_DEFAULT_COMMAND_SIZE);
*error= memcached_response(ptr, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, server_key);
if (*error == MEMCACHED_SUCCESS)
size_t send_length;
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
unsigned int server_key;
+ char *value;
+ memcached_return rc;
+ LIBMEMCACHED_MEMCACHED_GET_START();
*value_length= 0;
*error= memcached_connect(ptr);
return NULL;
}
- return memcached_value_fetch(ptr, key, &key_length, value_length, flags,
+ value= memcached_value_fetch(ptr, key, &key_length, value_length, flags,
error, 0, server_key);
+ /* We need to read END */
+ rc= memcached_response(ptr, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, server_key);
+ if (rc != MEMCACHED_NOTFOUND)
+ {
+ free(value);
+ *value_length= 0;
+ *error= MEMCACHED_PROTOCOL_ERROR;
+ }
+ LIBMEMCACHED_MEMCACHED_GET_END();
+
+ return value;
}
memcached_return memcached_mget(memcached_st *ptr,
unsigned int x;
memcached_return rc;
memcached_string_st **cursor_key_exec;
+ LIBMEMCACHED_MEMCACHED_MGET_START();
ptr->cursor_server= 0;
memset(buffer, 0, HUGE_STRING_LEN);
free(cursor_key_exec);
+ LIBMEMCACHED_MEMCACHED_MGET_END();
return rc;
}