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

NAME

6       memcached - libmemcached Documentation
7

SYNOPSIS

9       #include <libmemcached-1.0/memcached.h>
10              Compile and link with -lmemcached
11
12       memcached_st *memcached(const char *string, size_t string_length)
13
14              Parameters
15
16string -- configuration string
17
18string_length  --  length  of  the configuration string
19                       without any terminating zero
20
21              Returns
22                     allocated and initialized memcached_st struct
23
24       memcached_return_t  libmemcached_check_configuration(const  char   *op‐
25       tion_string,  size_t  length,  char  *error_buffer,  size_t  error_buf‐
26       fer_size)
27
28              Parameters
29
30option_string -- configuration string
31
32length -- length of the  configuration  string  without
33                       any terminating zero
34
35error_buffer -- buffer used to store any error message
36
37error_buffer_size -- available size of the error_buffer
38
39              Returns
40                     memcached_return_t indicating success
41

DESCRIPTION

43       libmemcached implements a custom language for configuring and modifying
44       servers. By passing in an option string you can generate a memcached_st
45       object that you can use in your application directly.
46
47   General Options:
48       --SERVER=<servername>:<optional_port>/?<optional_weight>
49              Provide a servername to be used by the client.
50
51              Providing  a weight will cause weighting to occur with all hosts
52              with each server getting a default weight of 1.
53
54       --SOCKET=\"<filepath>/?<optional_weight>\"
55              Provide a filepath to a UNIX socket  file.  Providing  a  weight
56              will  cause  weighting  to occur with all hosts with each server
57              getting a default weight of 1.
58
59       --VERIFY-KEY
60              Verify that keys that are being used fit within  the  design  of
61              the protocol being used.
62
63       --REMOVE_FAILED_SERVERS
64              Enable the behavior MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS.
65
66       --BINARY-PROTOCOL
67              Force all connections to use the binary protocol.
68
69       --BUFFER-REQUESTS
70              Please see MEMCACHED_BEHAVIOR_BUFFER_REQUESTS.
71
72       --CONFIGURE-FILE=
73              Provide a configuration file to be used to load requests. Beware
74              that by using a configuration file libmemcached will reset  mem‐
75              cached_st based on information only contained in the file.
76
77       --CONNECT-TIMEOUT=
78              See    memcached_behavior_set()    for   MEMCACHED_BEHAVIOR_CON‐
79              NECT_TIMEOUT.
80
81       --DISTRIBUTION=
82              Set the  distribution  model  used  by  the  client.   See  mem‐
83              cached_behavior_set() for more details.
84
85       --HASH=
86              Set the hashing algorithm used for placing keys on servers.
87
88       --HASH-WITH-NAMESPACE
89              When enabled the prefix key will be added to the key when deter‐
90              mining which server to store the data in.
91
92       --NOREPLY
93              Enable "no reply" for all calls that support this. It is  highly
94              recommended  that  you  use this option with the binary protocol
95              only.
96
97       --NUMBER-OF-REPLICAS=
98              Set the number of servers that keys will be replicated to.
99
100       --RANDOMIZE-REPLICA-READ
101              Select randomly the server within the replication pool  to  read
102              from.
103
104       --SORT-HOSTS
105              When  adding  new  servers  always  calculate their distribution
106              based on sorted naming order.
107
108       --SUPPORT-CAS
109              See memcached_behavior_set() for MEMCACHED_BEHAVIOR_SUPPORT_CAS
110
111       --USE-UDP
112              See memcached_behavior_set() for MEMCACHED_BEHAVIOR_USE_UDP
113
114       --NAMESPACE=
115              A namespace is a container that provides context for keys,  only
116              other  requests that know the namespace can access these values.
117              This is accomplished by prepending the namespace  value  to  all
118              keys.
119
120   Memcached Pool Options:
121       --POOL-MIN
122              Initial size of pool.
123
124       --POOL-MAX
125              Maximize size of the pool.
126
127   I/O Options:
128       --TCP-NODELAY
129              See memcached_behavior_set() for MEMCACHED_BEHAVIOR_TCP_NODELAY
130
131       --TCP-KEEPALIVE
132              See      memcached_behavior_set()      for      MEMCACHED_BEHAV‐
133              IOR_TCP_KEEPALIVE
134
135       --RETRY-TIMEOUT=
136              See memcached_behavior_set() for  MEMCACHED_BEHAVIOR_RETRY_TIME‐
137              OUT
138
139       --SERVER-FAILURE-LIMIT=
140              See memcached_behavior_set() for MEMCACHED_BEHAVIOR_SERVER_FAIL‐
141              URE_LIMIT
142
143       --SND-TIMEOUT=
144              See memcached_behavior_set() for MEMCACHED_BEHAVIOR_SND_TIMEOUT
145
146       --SOCKET-RECV-SIZE=
147              See      memcached_behavior_set()      for      MEMCACHED_BEHAV‐
148              IOR_SOCKET_RECV_SIZE
149
150       --SOCKET-SEND-SIZE=
151              See      memcached_behavior_set()      for      MEMCACHED_BEHAV‐
152              IOR_SOCKET_SEND_SIZE
153
154       --POLL-TIMEOUT=
155              Set the timeout used by poll(3).
156
157       --IO-BYTES-WATERMARK=
158
159       --IO-KEY-PREFETCH=
160
161       --IO-MSG-WATERMARK=
162
163       --TCP-KEEPIDLE
164
165       --RCV-TIMEOUT=
166
167   Other Options:
168       INCLUDE
169              Include a file in configuration.  Unlike --CONFIGURE-FILE=  this
170              will not reset memcached_st.
171
172       RESET  Reset memcached_st and continue to process.
173
174       END    End configuration processing.
175
176       ERROR  End configuration processing and throw an error.
177

ENVIRONMENT

179       LIBMEMCACHED
180

RETURN VALUE

182       memcached()  returns a pointer to the memcached_st that was created (or
183       initialized).  On an allocation failure, it returns NULL.
184

EXAMPLE

186          const char *config_string=
187            "--SERVER=host10.example.com "
188            "--SERVER=host11.example.com "
189            "--SERVER=host10.example.com";
190          memcached_st *memc= memcached(config_string, strlen(config_string));
191          {
192            // ...
193          }
194          memcached_free(memc);
195

SEE ALSO

197       memcached(1) libmemcached(3) memcached_strerror(3)
198
199
200
201
2021.1                              Sep 20, 2021                     MEMCACHED(3)
Impressum