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

NAME

6       memcached_servers - 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              Param ptr
125                     pointer to the memcached_st struct
126
127              Param server
128                     pointer to memcached_instance_st
129
130              Param context
131                     pointer to user supplied context
132
133              Returns
134                     memcached_return_t indicating success
135

DESCRIPTION

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

RETURN VALUE

185       Varies, see particular functions.
186

SEE ALSO

188       memcached(1)  libmemcached(3)   memcached_server_st(3)   memcached_str‐
189       error(3)
190
191
192
193
1941.1                              Nov 09, 2022             MEMCACHED_SERVERS(3)
Impressum