1 ========================================================
2 Manipulate the server information stored in memcached_st
3 ========================================================
9 #include <libmemcached/memcached.h>
11 .. c:type:: memcached_server_fn
13 .. c:function:: uint32_t memcached_server_count (memcached_st *ptr)
15 .. c:function:: memcached_return_t memcached_server_add (memcached_st *ptr, const char *hostname, in_port_t port)
17 .. c:function:: memcached_return_t memcached_server_add_udp (memcached_st *ptr, const char *hostname, in_port_t port)
19 .. c:function:: memcached_return_t memcached_server_add_unix_socket (memcached_st *ptr, const char *socket)
21 .. c:function:: memcached_return_t memcached_server_push (memcached_st *ptr, const memcached_server_st *list)
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)
25 .. c:function:: const memcached_instance_st * memcached_server_get_last_disconnect (const memcached_st *ptr)
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)
29 compile and link with -lmemcached
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).
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.
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`.
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`.
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`.
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.
62 :c:func:`memcached_server_by_key` allows you to provide a key and retrieve the
63 server which would be used for assignment.
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.
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.
82 Varies, see particular functions.
90 To find out more information please check:
91 `http://libmemcached.org/ <http://libmemcached.org/>`_
99 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`