840f62743e56bad1df07d7eceb5fd5ccd6a698dc
[awesomized/libmemcached] / docs / source / libmemcached / memcached_delete.rst
1 Deleting data from a server
2 ===========================
3
4 SYNOPSIS
5 --------
6
7 #include <libmemcached/memcached.h>
8 Compile and link with -lmemcached
9
10 .. function:: memcached_return_t memcached_delete(memcached_st *ptr, const char *key, size_t key_length, time_t expiration)
11
12 .. function:: memcached_return_t memcached_delete_by_key(memcached_st *ptr, const char *group_key, size_t group_key_length, const char *key, size_t key_length, time_t expiration)
13
14 :param ptr: pointer to initialized `memcached_st` struct
15 :param group_key: key namespace
16 :param group_key_length: length of the `group_key` without any terminating zero
17 :param key: the key to delete
18 :param key_length: the length og the `key` without any terminating zero
19 :param expiration: obsolete since :manpage:`memcached(1)` version 1.4
20 :returns: `memcached_return_t` indicating success
21
22 DESCRIPTION
23 -----------
24
25 `memcached_delete` is used to delete a particular key. `memcached_delete_by_key`
26 works the same, but it takes a master key to find the given value.
27
28 Expiration works by placing the item into a delete queue, which means that it
29 won't be possible to retrieve it by the "get" command. The "add" and "replace"
30 commands with this key will also fail (the "set" command will succeed, however).
31 After the time passes, the item is finally deleted from server memory.
32
33 Please note the the memcached server removed tests for expiration in the 1.4
34 version.
35
36 RETURN VALUE
37 ------------
38
39 A value of type `memcached_return_t` is returned
40 On success that value will be `MEMCACHED_SUCCESS`.
41 Use `memcached_strerror` to translate this value to a printable string.
42
43 If you are using the non-blocking mode of the library, success only means that
44 the message was queued for delivery.
45
46 SEE ALSO
47 --------
48
49 .. only:: man
50
51 :manpage:`memcached(1)`
52 :manpage:`libmemcached(3)`
53 :manpage:`memcached_strerror(3)`
54
55 .. only:: html
56
57 * :manpage:`memcached(1)`
58 * :doc:`../libmemcached`
59 * :doc:`memcached_strerror`