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