{
bool to_write;
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
- uint32_t server_key;
memcached_server_write_instance_st instance;
LIBMEMCACHED_MEMCACHED_DELETE_START();
memcached_return_t rc;
- if ((rc= initialize_query(ptr)) != MEMCACHED_SUCCESS)
+ if (memcached_failed(rc= initialize_query(ptr)))
{
return rc;
}
rc= memcached_validate_key_length(key_length,
ptr->flags.binary_protocol);
- unlikely (rc != MEMCACHED_SUCCESS)
+
+ unlikely (memcached_failed(rc))
return rc;
unlikely (memcached_server_count(ptr) == 0)
return MEMCACHED_NO_SERVERS;
- server_key= memcached_generate_hash_with_redistribution(ptr, group_key, group_key_length);
+ uint32_t server_key= memcached_generate_hash_with_redistribution(ptr, group_key, group_key_length);
instance= memcached_server_instance_fetch(ptr, server_key);
to_write= (ptr->flags.buffer_requests) ? false : true;
}
send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
"delete %.*s%.*s %u%s\r\n",
- memcached_print_array(ptr->prefix_key),
+ memcached_print_array(ptr->_namespace),
(int) key_length, key,
(uint32_t)expiration,
no_reply ? " noreply" :"" );
{
send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
"delete %.*s%.*s%s\r\n",
- memcached_print_array(ptr->prefix_key),
+ memcached_print_array(ptr->_namespace),
(int)key_length, key, no_reply ? " noreply" :"");
}
if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE || send_length < 0)
{
- rc= MEMCACHED_WRITE_FAILURE;
+ rc= memcached_set_error(*ptr, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT,
+ memcached_literal_param("snprintf(MEMCACHED_DEFAULT_COMMAND_SIZE)"));
goto error;
}
{
if (send_length > MAX_UDP_DATAGRAM_LENGTH - UDP_DATAGRAM_HEADER_LENGTH)
return MEMCACHED_WRITE_FAILURE;
+
if (send_length + instance->write_buffer_offset > MAX_UDP_DATAGRAM_LENGTH)
memcached_io_write(instance, NULL, 0, true);
}
{
request.message.header.request.opcode= PROTOCOL_BINARY_CMD_DELETE;
}
- request.message.header.request.keylen= htons((uint16_t)(key_length + memcached_array_size(ptr->prefix_key)));
+ request.message.header.request.keylen= htons((uint16_t)(key_length + memcached_array_size(ptr->_namespace)));
request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
- request.message.header.request.bodylen= htonl((uint32_t)(key_length + memcached_array_size(ptr->prefix_key)));
+ request.message.header.request.bodylen= htonl((uint32_t)(key_length + memcached_array_size(ptr->_namespace)));
if (ptr->flags.use_udp && ! flush)
{
size_t cmd_size= sizeof(request.bytes) + key_length;
if (cmd_size > MAX_UDP_DATAGRAM_LENGTH - UDP_DATAGRAM_HEADER_LENGTH)
return MEMCACHED_WRITE_FAILURE;
+
if (cmd_size + instance->write_buffer_offset > MAX_UDP_DATAGRAM_LENGTH)
memcached_io_write(instance, NULL, 0, true);
}
struct libmemcached_io_vector_st vector[]=
{
{ sizeof(request.bytes), request.bytes},
- { memcached_array_size(ptr->prefix_key), memcached_array_string(ptr->prefix_key) },
+ { memcached_array_size(ptr->_namespace), memcached_array_string(ptr->_namespace) },
{ key_length, key },
};