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