Style cleanup
[m6w6/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:: 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 :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. This structure is cloned
64 from its original structure and must be freed. If NULL is returned you
65 should consult \*error. The returning structure should be freed with
66 :c:func:`memcached_server_free()`.
67
68 :c:func:`memcached_server_get_last_disconnect()` returns a pointer to the last
69 server for which there was a connection problem. It does not mean this
70 particular server is currently dead but if the library is reporting a server
71 is, the returned server is a very good candidate.
72
73 :c:func:`memcached_server_cursor()` takes a memcached_st and loops through the
74 list of hosts currently in the cursor calling the list of callback
75 functions provided. You can optionally pass in a value via
76 context which will be provided to each callback function. An error
77 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.
78
79
80 ------
81 RETURN
82 ------
83
84
85 Varies, see particular functions.
86
87
88 ----
89 HOME
90 ----
91
92
93 To find out more information please check:
94 `http://libmemcached.org/ <http://libmemcached.org/>`_
95
96
97 --------
98 SEE ALSO
99 --------
100
101
102 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`