docs: sanitize
[awesomized/libmemcached] / docs / source / libmemcached / memcached_servers.rst
1 Manipulate the server information stored in memcached_st
2 ========================================================
3
4 SYNOPSIS
5 --------
6
7 #include <libmemcached/memcached.h>
8
9 .. type:: memcached_server_fn
10
11 .. function:: uint32_t memcached_server_count (memcached_st *ptr)
12
13 .. function:: memcached_return_t memcached_server_add (memcached_st *ptr, const char *hostname, in_port_t port)
14
15 .. function:: memcached_return_t memcached_server_add_udp (memcached_st *ptr, const char *hostname, in_port_t port)
16
17 .. function:: memcached_return_t memcached_server_add_unix_socket (memcached_st *ptr, const char *socket)
18
19 .. function:: memcached_return_t memcached_server_push (memcached_st *ptr, const memcached_server_st *list)
20
21 .. function:: const memcached_instance_st * memcached_server_by_key (memcached_st *ptr, const char *key, size_t key_length, memcached_return_t *error)
22
23 .. function:: const memcached_instance_st * memcached_server_get_last_disconnect (const memcached_st *ptr)
24
25 .. function:: memcached_return_t memcached_server_cursor(const memcached_st *ptr, const memcached_server_fn *callback, void *context, uint32_t number_of_callbacks)
26
27 compile and link with -lmemcached
28
29 DESCRIPTION
30 -----------
31
32 `libmemcached` performs operations on a list of hosts. The order of
33 these hosts determine routing to keys. Functions are provided to add keys to
34 memcached_st structures. To manipulate lists of servers see
35 memcached_server_st(3).
36
37 :func:`memcached_server_count` provides you a count of the current number of
38 servers being used by a :type:`memcached_st` structure.
39
40 :func:`memcached_server_add` pushes a single TCP server into the :type:`memcached_st` structure. This server will be placed at the end. Duplicate servers
41 are allowed, so duplication is not checked. Executing this function with the `MEMCACHED_BEHAVIOR_USE_UDP` behavior set will result in a `MEMCACHED_INVALID_HOST_PROTOCOL`.
42
43 :func:`memcached_server_add_udp` pushes a single UDP server into the :type:`memcached_st` structure. This server will be placed at the end. Duplicate
44 servers are allowed, so duplication is not checked. Executing this function with out setting the `MEMCACHED_BEHAVIOR_USE_UDP` behavior will result in a
45 `MEMCACHED_INVALID_HOST_PROTOCOL`.
46
47 :func:`memcached_server_add_unix_socket` pushes a single UNIX socket into the :type:`memcached_st` structure. This UNIX socket will be placed at the end.
48 Duplicate servers are allowed, so duplication is not checked. The length
49 of the filename must be one character less than `MEMCACHED_MAX_HOST_LENGTH`.
50
51 :func:`memcached_server_push` pushes an array of :type:`memcached_server_st` into the :type:`memcached_st` structure. These servers will be placed at
52 the end. Duplicate servers are allowed, so duplication is not checked. A
53 copy is made of structure so the list provided (and any operations on
54 the list) are not saved.
55
56 :func:`memcached_server_by_key` allows you to provide a key and retrieve the
57 server which would be used for assignment.
58
59 :func:`memcached_server_get_last_disconnect` returns a pointer to the last
60 server for which there was a connection problem. It does not mean this
61 particular server is currently dead but if the library is reporting a server
62 is, the returned server is a very good candidate.
63
64 :func:`memcached_server_cursor` takes a memcached_st and loops through the
65 list of hosts currently in the cursor calling the list of callback
66 functions provided. You can optionally pass in a value via
67 context which will be provided to each callback function. An error
68 return from any callback will terminate the loop. :func:`memcached_server_cursor` is passed the original caller :type:`memcached_st` in its current state.
69
70 RETURN
71 ------
72
73 Varies, see particular functions.
74
75 SEE ALSO
76 --------
77
78 .. only:: man
79
80 :manpage:`memcached(1)`
81 :manpage:`libmemcached(3)`
82 :manpage:`memcached_strerror(3)`