Merge bzr://10.0.3.21 Build: jenkins-Libmemcached-469
[awesomized/libmemcached] / docs / memcached_servers.rst
1 ========================================================
2 Manipulate the server information stored in memcached_st
3 ========================================================
4
5 --------
6 SYNOPSIS
7 --------
8
9 #include <libmemcached/memcached.h>
10
11 .. c:type:: memcached_server_fn
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:: const memcached_instance_st * memcached_server_by_key (memcached_st *ptr, const char *key, size_t key_length, memcached_return_t *error)
24
25 .. c:function:: const memcached_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 :doc:`libmemcached` performs operations on a list of hosts. The order of
39 these 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 :c:func:`memcached_server_count` provides you a count of the current number of
44 servers being used by a :c:type:`memcached_st` structure.
45
46 :c:func:`memcached_server_add` pushes a single TCP server into the :c:type:`memcached_st` structure. This server will be placed at the end. Duplicate servers
47 are allowed, so duplication is not checked. Executing this function with the :c:type:`MEMCACHED_BEHAVIOR_USE_UDP` behavior set will result in a :c:type:`MEMCACHED_INVALID_HOST_PROTOCOL`.
48
49 :c:func:`memcached_server_add_udp` pushes a single UDP server into the :c:type:`memcached_st` structure. This server will be placed at the end. Duplicate
50 servers are allowed, so duplication is not checked. Executing this function with out setting the :c:type:`MEMCACHED_BEHAVIOR_USE_UDP` behavior will result in a
51 :c:type:`MEMCACHED_INVALID_HOST_PROTOCOL`.
52
53 :c:func:`memcached_server_add_unix_socket` pushes a single UNIX socket into the :c:type:`memcached_st` structure. This UNIX socket will be placed at the end.
54 Duplicate servers are allowed, so duplication is not checked. The length
55 of the filename must be one character less than :c:type:`MEMCACHED_MAX_HOST_LENGTH`.
56
57 :c:func:`memcached_server_push` pushes an array of :c:type:`memcached_server_st` into the :c:type:`memcached_st` structure. These servers will be placed at
58 the end. Duplicate servers are allowed, so duplication is not checked. A
59 copy is made of structure so the list provided (and any operations on
60 the list) are not saved.
61
62 :c:func:`memcached_server_by_key` allows you to provide a key and retrieve the
63 server which would be used for assignment.
64
65 :c:func:`memcached_server_get_last_disconnect` returns a pointer to the last
66 server for which there was a connection problem. It does not mean this
67 particular server is currently dead but if the library is reporting a server
68 is, the returned server is a very good candidate.
69
70 :c:func:`memcached_server_cursor` takes a memcached_st and loops through the
71 list of hosts currently in the cursor calling the list of callback
72 functions provided. You can optionally pass in a value via
73 context which will be provided to each callback function. An error
74 return from any callback will terminate the loop. :c:func:`memcached_server_cursor` is passed the original caller :c:type:`memcached_st` in its current state.
75
76
77 ------
78 RETURN
79 ------
80
81
82 Varies, see particular functions.
83
84
85 ----
86 HOME
87 ----
88
89
90 To find out more information please check:
91 `http://libmemcached.org/ <http://libmemcached.org/>`_
92
93
94 --------
95 SEE ALSO
96 --------
97
98
99 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`