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