const char *key, size_t key_length,
time_t expiration)
{
- bool to_write;
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
memcached_server_write_instance_st instance;
rc= memcached_validate_key_length(key_length,
ptr->flags.binary_protocol);
- unlikely (memcached_failed(rc))
+ if (memcached_failed(rc))
+ {
return rc;
-
- unlikely (memcached_server_count(ptr) == 0)
- return MEMCACHED_NO_SERVERS;
+ }
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;
+ bool to_write= (ptr->flags.buffer_requests) ? false : true;
bool no_reply= (ptr->flags.no_reply);
if (instance->minor_version == 0)
{
- if (no_reply || ! to_write)
+ if (no_reply or to_write == false)
{
/* We might get out of sync with the server if we
* send this command to a server newer than 1.2.x..
}
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 (ptr->flags.use_udp && ! to_write)
+ if (ptr->flags.use_udp and to_write == false)
{
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);
+ }
}
rc= memcached_do(instance, buffer, (size_t)send_length, to_write);
}
if (rc != MEMCACHED_SUCCESS)
+ {
goto error;
+ }
- if (! to_write)
+ if (to_write == false)
{
rc= MEMCACHED_BUFFERED;
}
- else if (!no_reply)
+ else if (no_reply == false)
{
rc= memcached_response(instance, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL);
if (rc == MEMCACHED_DELETED)
+ {
rc= MEMCACHED_SUCCESS;
+ }
}
- if (rc == MEMCACHED_SUCCESS && ptr->delete_trigger)
+ if (rc == MEMCACHED_SUCCESS and ptr->delete_trigger)
+ {
ptr->delete_trigger(ptr, key, key_length);
+ }
error:
LIBMEMCACHED_MEMCACHED_DELETE_END();
{
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)
{
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 },
};
if ((rc= memcached_vdo(instance, vector, 3, flush)) != MEMCACHED_SUCCESS)
{
memcached_io_reset(instance);
- rc= (rc == MEMCACHED_SUCCESS) ? MEMCACHED_WRITE_FAILURE : rc;
}
unlikely (ptr->number_of_replicas > 0)