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