3 memcached_return
memcached_delete(memcached_st
*ptr
, char *key
, size_t key_length
,
8 char buffer
[MEMCACHED_DEFAULT_COMMAND_SIZE
];
10 rc
= memcached_connect(ptr
);
13 send_length
= snprintf(buffer
, MEMCACHED_DEFAULT_COMMAND_SIZE
,
14 "delete %.*s %u\r\n", key_length
, key
, expiration
);
16 send_length
= snprintf(buffer
, MEMCACHED_DEFAULT_COMMAND_SIZE
,
17 "delete %.*s\r\n", key_length
, key
);
18 if ((write(ptr
->fd
, buffer
, send_length
) == -1))
20 fprintf(stderr
, "failed set on %.*s TCP\n", key_length
+1, key
);
22 return MEMCACHED_WRITE_FAILURE
;
25 return memcached_response(ptr
, buffer
, MEMCACHED_DEFAULT_COMMAND_SIZE
);