+
+static inline memcached_return binary_delete(memcached_st *ptr,
+ unsigned int server_key,
+ const char *key,
+ size_t key_length,
+ int flush)
+{
+ protocol_binary_request_delete request= {.bytes= {0}};
+
+ request.message.header.request.magic= PROTOCOL_BINARY_REQ;
+ request.message.header.request.opcode= PROTOCOL_BINARY_CMD_DELETE;
+ request.message.header.request.keylen= htons((uint16_t)key_length);
+ request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
+ request.message.header.request.bodylen= htonl(key_length);
+
+ if ((memcached_do(&ptr->hosts[server_key], request.bytes,
+ sizeof(request.bytes), 0) != MEMCACHED_SUCCESS) ||
+ (memcached_io_write(&ptr->hosts[server_key], key,
+ key_length, flush) == -1))
+ {
+ memcached_io_reset(&ptr->hosts[server_key]);
+ return MEMCACHED_WRITE_FAILURE;
+ }
+
+ return MEMCACHED_SUCCESS;
+}