1MEMCACHED_SERVER_CURSOR(3)   libmemcached-awesome   MEMCACHED_SERVER_CURSOR(3)
2
3
4

NAME

6       memcached_server_cursor - libmemcached Documentation
7

SYNOPSIS

9       #include <libmemcached/memcached.h>
10              Compile and link with -lmemcached
11
12       uint32_t memcached_server_count(memcached_st *ptr)
13
14              Parameters
15                     ptr -- pointer to initialized memcached_st struct
16
17              Returns
18                     number of configured servers
19
20       memcached_return_t  memcached_server_add(memcached_st  *ptr, const char
21       *hostname, in_port_t port)
22
23              Parameters
24
25ptr -- pointer to initialized memcached_st struct
26
27hostname -- hostname or IP address of the TCP server to
28                       add
29
30port -- port of the TCP server
31
32              Returns
33                     memcached_return_t indicating success
34
35       memcached_return_t  memcached_server_add_udp(memcached_st  *ptr,  const
36       char *hostname, in_port_t port)
37
38              Parameters
39
40ptr -- pointer to initialized memcached_st struct
41
42hostname -- hostname or IP address of the UDP server to
43                       add
44
45port -- port of the UDP server
46
47              Returns
48                     memcached_return_t indicating success
49
50       memcached_return_t  memcached_server_add_unix_socket(memcached_st *ptr,
51       const char *socket)
52
53              Parameters
54
55ptr -- pointer to initialized memcached_st struct
56
57socket -- path to the UNIX socket of the server to add
58
59              Returns
60                     memcached_return_t indicating success
61
62       memcached_return_t memcached_server_push(memcached_st *ptr, const  mem‐
63       cached_server_st *list)
64
65              Parameters
66
67ptr -- pointer to initialized memcached_st struct
68
69list -- pre-configured list of servers to push
70
71              Returns
72                     memcached_return_t indicating success
73
74       const memcached_instance_st *memcached_server_by_key(memcached_st *ptr,
75       const char *key, size_t key_length, memcached_return_t *error)
76
77              Parameters
78
79ptr -- pointer to initialized memcached_st struct
80
81key -- key to hash and lookup a server
82
83key_length -- length of  key  without  any  terminating
84                       zero
85
86error  -- pointer to memcached_return_t indicating suc‐
87                       cess
88
89              Returns
90                     the server instance to be used for storing/retrieving key
91
92       const memcached_instance_st *memcached_server_get_last_disconnect(const
93       memcached_st *ptr)
94
95              Parameters
96                     ptr -- pointer to initialized memcached_st struct
97
98              Returns
99                     the  instance  of  the  last server for which there was a
100                     connection problem
101
102       memcached_return_t  memcached_server_cursor(const  memcached_st   *ptr,
103       const  memcached_server_fn  *callback,  void  *context,  uint32_t  num‐
104       ber_of_callbacks)
105
106              Parameters
107
108ptr -- pointer to initialized memcached_st struct
109
110callback -- list of memcached_server_fn  to  be  called
111                       for each server instance
112
113context  --  pointer  to  user supplied context for the
114                       callback
115
116number_of_callbacks -- number of callbacks supplied
117
118              Returns
119                     memcached_return_t indicating success
120
121       typedef  memcached_return_t  (*memcached_server_fn)(const  memcached_st
122       *ptr, const memcached_instance_st *server, void *context)
123
124              Parameters
125
126ptr -- pointer to the memcached_st struct
127
128server -- pointer to memcached_instance_st
129
130context -- pointer to user supplied context
131
132              Returns
133                     memcached_return_t indicating success
134

DESCRIPTION

136       libmemcached performs operations on a list of hosts. The order of these
137       hosts determine routing to keys. Functions are provided to add keys  to
138       memcached_st  structures.  To  manipulate  lists  of  servers  see mem‐
139       cached_server_st.
140
141       memcached_server_count() provides you a count of the current number  of
142       servers being used by a memcached_st structure.
143
144       memcached_server_add() pushes a single TCP server into the memcached_st
145       structure. This server will be placed at the  end.   Duplicate  servers
146       are  allowed,  so  duplication  is not checked. Executing this function
147       with the MEMCACHED_BEHAVIOR_USE_UDP behavior set will result in a  MEM‐
148       CACHED_INVALID_HOST_PROTOCOL.
149
150       memcached_server_add_udp()  pushes  a  single  UDP server into the mem‐
151       cached_st structure. This server will be placed at the  end.  Duplicate
152       servers  are  allowed,  so  duplication  is not checked. Executing this
153       function without setting the MEMCACHED_BEHAVIOR_USE_UDP  behavior  will
154       result in a MEMCACHED_INVALID_HOST_PROTOCOL.
155
156       memcached_server_add_unix_socket() pushes a single UNIX socket into the
157       memcached_st structure. This UNIX socket will be  placed  at  the  end.
158       Duplicate  servers  are  allowed,  so  duplication  is not checked. The
159       length  of  the  filename  must  be  one  character  less   than   MEM‐
160       CACHED_MAX_HOST_LENGTH.
161
162       memcached_server_push() pushes an array of memcached_server_st into the
163       memcached_st structure. These servers will be placed at the end. Dupli‐
164       cate servers are allowed, so duplication is not checked. A copy is made
165       of structure so the list provided (and any operations on the list)  are
166       not saved.
167
168       memcached_server_by_key()  allows you to provide a key and retrieve the
169       server which would be used for assignment.
170
171       memcached_server_get_last_disconnect() returns a pointer  to  the  last
172       server  for which there was a connection problem. It does not mean this
173       particular server is currently dead but if the library is  reporting  a
174       server is, the returned server is a very good candidate.
175
176       memcached_server_cursor()  takes  a  memcached_st and loops through the
177       list of hosts currently in the cursor  calling  the  list  of  callback
178       functions  provided.  You  can  optionally  pass in a value via context
179       which will be provided to each callback function. An error return  from
180       any  callback  will  terminate  the loop.  memcached_server_cursor() is
181       passed the original caller memcached_st in its current state.
182

RETURN VALUE

184       Varies, see particular functions.
185

SEE ALSO

187       memcached(1)  libmemcached(3)   memcached_server_st(3)   memcached_str‐
188       error(3)
189
190
191
192
1931.1                              Sep 20, 2021       MEMCACHED_SERVER_CURSOR(3)
Impressum