-
Notifications
You must be signed in to change notification settings - Fork 7
/
memcache.php
307 lines (229 loc) · 8.74 KB
/
memcache.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
<?php
// Start of memcache v.3.0.9-dev
class MemcachePool {
public function connect() {}
public function addserver() {}
public function setserverparams() {}
public function setfailurecallback() {}
public function getserverstatus() {}
public function findserver() {}
public function getversion() {}
public function add() {}
public function set() {}
public function replace() {}
public function cas() {}
public function append() {}
public function prepend() {}
/**
* @param $var1
* @param $var2
* @param $var3
*/
public function get($var1, &$var2, &$var3) {}
public function delete() {}
public function getstats() {}
public function getextendedstats() {}
public function setcompressthreshold() {}
public function increment() {}
public function decrement() {}
public function close() {}
public function flush() {}
public function setSaslAuthData() {}
}
/**
* Represents a connection to a set of memcache servers.
* @link http://php.net/manual/en/class.memcache.php
*/
class Memcache extends MemcachePool {
/**
* (PECL memcache >= 0.2.0)<br/>
* Open memcached server connection
* @link http://php.net/manual/en/memcache.connect.php
* @param string $host <p>
* Point to the host where memcached is listening for connections. This parameter
* may also specify other transports like unix:///path/to/memcached.sock
* to use UNIX domain sockets, in this case <i>port</i> must also
* be set to 0.
* </p>
* @param int $port [optional] <p>
* Point to the port where memcached is listening for connections. Set this
* parameter to 0 when using UNIX domain sockets.
* </p>
* <p>
* Please note: <i>port</i> defaults to
* memcache.default_port
* if not specified. For this reason it is wise to specify the port
* explicitly in this method call.
* </p>
* @param int $timeout [optional] <p>
* Value in seconds which will be used for connecting to the daemon. Think
* twice before changing the default value of 1 second - you can lose all
* the advantages of caching if your connection is too slow.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
public function connect(string $host, int $port = null, int $timeout = null): bool {}
/**
* (PECL memcache >= 0.4.0)<br/>
* Open memcached server persistent connection
* @link http://php.net/manual/en/memcache.pconnect.php
* @param string $host <p>
* Point to the host where memcached is listening for connections. This parameter
* may also specify other transports like unix:///path/to/memcached.sock
* to use UNIX domain sockets, in this case <i>port</i> must also
* be set to 0.
* </p>
* @param int $port [optional] <p>
* Point to the port where memcached is listening for connections. Set this
* parameter to 0 when using UNIX domain sockets.
* </p>
* @param int $timeout [optional] <p>
* Value in seconds which will be used for connecting to the daemon. Think
* twice before changing the default value of 1 second - you can lose all
* the advantages of caching if your connection is too slow.
* </p>
* @return mixed a Memcache object or <b>FALSE</b> on failure.
*/
public function pconnect(string $host, int $port = null, int $timeout = null) {}
/**
* (PECL memcache >= 2.0.0)<br/>
* Add a memcached server to connection pool
* @link http://php.net/manual/en/memcache.addserver.php
* @param string $host <p>
* Point to the host where memcached is listening for connections. This parameter
* may also specify other transports like unix:///path/to/memcached.sock
* to use UNIX domain sockets, in this case <i>port</i> must also
* be set to 0.
* </p>
* @param int $port [optional] <p>
* Point to the port where memcached is listening for connections.
* Set this
* parameter to 0 when using UNIX domain sockets.
* </p>
* <p>
* Please note: <i>port</i> defaults to
* memcache.default_port
* if not specified. For this reason it is wise to specify the port
* explicitly in this method call.
* </p>
* @param bool $persistent [optional] <p>
* Controls the use of a persistent connection. Default to <b>TRUE</b>.
* </p>
* @param int $weight [optional] <p>
* Number of buckets to create for this server which in turn control its
* probability of it being selected. The probability is relative to the
* total weight of all servers.
* </p>
* @param int $timeout [optional] <p>
* Value in seconds which will be used for connecting to the daemon. Think
* twice before changing the default value of 1 second - you can lose all
* the advantages of caching if your connection is too slow.
* </p>
* @param int $retry_interval [optional] <p>
* Controls how often a failed server will be retried, the default value
* is 15 seconds. Setting this parameter to -1 disables automatic retry.
* Neither this nor the <i>persistent</i> parameter has any
* effect when the extension is loaded dynamically via <b>dl</b>.
* </p>
* <p>
* Each failed connection struct has its own timeout and before it has expired
* the struct will be skipped when selecting backends to serve a request. Once
* expired the connection will be successfully reconnected or marked as failed
* for another <i>retry_interval</i> seconds. The typical
* effect is that each web server child will retry the connection about every
* <i>retry_interval</i> seconds when serving a page.
* </p>
* @param bool $status [optional] <p>
* Controls if the server should be flagged as online. Setting this parameter
* to <b>FALSE</b> and <i>retry_interval</i> to -1 allows a failed
* server to be kept in the pool so as not to affect the key distribution
* algorithm. Requests for this server will then failover or fail immediately
* depending on the <i>memcache.allow_failover</i> setting.
* Default to <b>TRUE</b>, meaning the server should be considered online.
* </p>
* @param callable $failure_callback [optional] <p>
* Allows the user to specify a callback function to run upon encountering an
* error. The callback is run before failover is attempted. The function takes
* two parameters, the hostname and port of the failed server.
* </p>
* @param int $timeoutms [optional] <p>
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
public function addserver(string $host, int $port = 11211, bool $persistent = null, int $weight = null, int $timeout = null, int $retry_interval = null, bool $status = null, callable $failure_callback = null, int $timeoutms = null): bool {}
public function setserverparams() {}
public function setfailurecallback() {}
public function getserverstatus() {}
public function findserver() {}
public function getversion() {}
public function add() {}
public function set() {}
public function replace() {}
public function cas() {}
public function append() {}
public function prepend() {}
/**
* @param $var1
* @param $var2
* @param $var3
*/
public function get($var1, &$var2, &$var3) {}
public function delete() {}
public function getstats() {}
public function getextendedstats() {}
public function setcompressthreshold() {}
public function increment() {}
public function decrement() {}
public function close() {}
public function flush() {}
public function setSaslAuthData() {}
}
function memcache_connect() {}
function memcache_pconnect() {}
function memcache_add_server() {}
function memcache_set_server_params() {}
function memcache_set_failure_callback() {}
function memcache_get_server_status() {}
function memcache_get_version() {}
function memcache_add() {}
function memcache_set() {}
function memcache_replace() {}
function memcache_cas() {}
function memcache_append() {}
function memcache_prepend() {}
/**
* @param $var1
* @param $var2
* @param $var3
* @param $var4
*/
function memcache_get($var1, $var2, &$var3, &$var4) {}
function memcache_delete() {}
/**
* (PECL memcache >= 0.2.0)<br/>
* Turn debug output on/off
* @link http://php.net/manual/en/function.memcache-debug.php
* @param bool $on_off <p>
* Turns debug output on if equals to <b>TRUE</b>.
* Turns debug output off if equals to <b>FALSE</b>.
* </p>
* @return bool <b>TRUE</b> if PHP was built with --enable-debug option, otherwise
* returns <b>FALSE</b>.
*/
function memcache_debug(bool $on_off): bool {}
function memcache_get_stats() {}
function memcache_get_extended_stats() {}
function memcache_set_compress_threshold() {}
function memcache_increment() {}
function memcache_decrement() {}
function memcache_close() {}
function memcache_flush() {}
function memcache_set_sasl_auth_data() {}
define ('MEMCACHE_COMPRESSED', 2);
define ('MEMCACHE_USER1', 65536);
define ('MEMCACHE_USER2', 131072);
define ('MEMCACHE_USER3', 262144);
define ('MEMCACHE_USER4', 524288);
define ('MEMCACHE_HAVE_SESSION', 1);
// End of memcache v.3.0.9-dev
?>