1 Managing lists of servers
2 =========================
7 #include <libmemcached/memcached.h>
8 Compile and link with -lmemcached
10 .. c:type:: struct memcached_instance_st memcached_instance_st
12 .. c:type:: struct memcached_server_st memcached_server_st
14 .. c:type:: struct memcached_server_st *memcached_server_list_st
16 .. function:: void memcached_server_list_free (memcached_server_list_st list)
18 :param list: instance of initialized `memcached_server_list_st` object
20 .. function:: memcached_server_list_st memcached_server_list_append (memcached_server_list_st list, const char *hostname, in_port_t port, memcached_return_t *error)
22 :param list: instance of an existing `memcached_server_list_st` or nullptr to create one
23 :param hostname: the hostname or path to the socket, defaults to localhost if null
24 :param port: the port to use, defaults to 11211 if 0
25 :param error: pointer to store any `memcached_return_t` error indicating success
26 :returns: new instance of `memcached_server_list_st` on success or nullptr on failure
28 .. function:: uint32_t memcached_server_list_count (memcached_server_list_st list)
30 :param list: instance of `memcached_server_list_st`
31 :returns: count of servers in the list
33 .. function:: const char *memcached_server_error (const memcached_instance_st * instance)
35 :param instance: pointer to an initialized `memcached_instance_st` object
36 :returns: last error message sent from the server to the client
38 .. function:: void memcached_server_error_reset (const memcached_instance_st * list)
42 .. function:: void memcached_servers_parse ()
51 `libmemcached` operates on a list of hosts which are stored in
52 :type:`memcached_server_st` structures. You should not modify these structures
53 directly. Functions are provided to modify these structures.
55 :func:`memcached_server_list` is used to provide an array of all defined hosts.
56 This was incorrectly documented as "requiring free" up till version 0.39.
58 :func:`memcached_server_list_free` deallocates all memory associated with the
59 array of :type:`memcached_server_st` that you passed to it.
61 :func:`memcached_server_list_append` adds a server to the end of a
62 :type:`memcached_server_st` array. On error null will be returned and the
63 :type:`memcached_return_t` pointer you passed into the function will be set with the appropriate error. If the value of port is zero, it is set to the default
64 port of a memcached server.
66 DEPRECATED :func:`memcached_servers_parse`, please see :func:`memcached`
68 :func:`memcached_server_error` can be used to look at the text of the last
69 error message sent by the server to to the client.
71 Before version 0.39 theses functions used a memcached_server_st \*. In 0.39
72 memcached_server_st \* was aliased to :type:`memcached_server_list_st`.
73 This was done for a style reason to help clean up some concepts in the code.
78 Varies, see particular functions.
85 :manpage:`memcached(1)`
86 :manpage:`libmemcached(3)`
87 :manpage:`memcached_servers(3)`
88 :manpage:`memcached_strerror(3)`
92 * :manpage:`memcached(1)`
93 * :doc:`../libmemcached`
94 * :doc:`memcached_servers`
95 * :doc:`memcached_strerror`