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