forked from JetBrains/phpstorm-stubs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmemcache.php
426 lines (374 loc) · 18.8 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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
<?php
// Start of memcache v.3.0.8
class 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 <em>unix:///path/to/memcached.sock</em>
* to use UNIX domain sockets, in this case <b>port</b> must also
* be set to <em>0</em>.
* </p>
* @param int $port [optional] <p>
* Point to the port where memcached is listening for connections. Set this
* parameter to <em>0</em> when using UNIX domain sockets.
* </p>
* <p>
* Please note: <b>port</b> defaults to
* {@link http://php.net/manual/ru/memcache.ini.php#ini.memcache.default-port 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 boolean <p>Returns <b>TRUE</b> on success or <b>FALSE</b> on failure.</p>
*/
public function connect ($host, $port, $timeout = 1) {}
/**
* (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 ($host, $port = 11211, $persistent = true, $weight = null, $timeout = 1, $retry_interval = 15, $status = true, callable $failure_callback = null, $timeoutms) {}
/**
* (PECL memcache >= 2.1.0)<br/>
* Changes server parameters and status at runtime
* @link http://www.php.net/manual/en/memcache.setserverparams.php
* @param string $host <p>Point to the host where memcached is listening for connections.</p.
* @param int $port [optional] <p>
* Point to the port where memcached is listening for connections.
* </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 <b>persistent</b> parameter has any
* effect when the extension is loaded dynamically via {@link http://www.php.net/manual/en/function.dl.php dl()}.
* </p>
* @param bool $status [optional] <p>
* Controls if the server should be flagged as online. Setting this parameter
* to <b>FALSE</b> and <b>retry_interval</b> 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 <b>memcache.allow_failover</b> 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>
* @return boolean <p>Returns <b>TRUE</b> on success or <b>FALSE</b> on failure.</p>
*/
public function setServerParams ($host, $port = 11211, $timeout = 1, $retry_interval = 15, $status = true, callable $failure_callback) {}
/**
*
*/
public function setFailureCallback () {}
/**
* (PECL memcache >= 2.1.0)<br/>
* Returns server status
* @link http://php.net/manual/en/memcache.getserverstatus.php
* @param string $host Point to the host where memcached is listening for connections.
* @param int $port Point to the port where memcached is listening for connections.
* @return int Returns a the servers status. 0 if server is failed, non-zero otherwise
*/
public function getserverstatus ($host, $port = 11211) {}
/**
*
*/
public function findserver () {}
/**
* (PECL memcache >= 0.2.0)<br/>
* Return version of the server
* @link http://php.net/manual/en/memcache.getversion.php
* @return string|boolean Returns a string of server version number or <b>FALSE</b> on failure.
*/
public function getversion () {}
/**
* (PECL memcache >= 2.0.0)<br/>
* Get statistics from all servers in pool
* @link http://php.net/manual/en/memcache.add.php
* @param string $key The key that will be associated with the item.
* @param mixed $var The variable to store. Strings and integers are stored as is, other types are stored serialized.
* @param int $flag [optional] <p>
* Use <b>MEMCACHE_COMPRESSED</b> to store the item
* compressed (uses zlib).
* </p>
* @param int $expire [optional] <p>Expiration time of the item.
* If it's equal to zero, the item will never expire.
* You can also use Unix timestamp or a number of seconds starting from current time, but in the latter case the number of seconds may not exceed 2592000 (30 days).</p>
* @return array|boolean Returns a two-dimensional associative array of server statistics or <b>FALSE</b> on failure.
*/
public function add ($key , $var, $flag, $expire) {}
/**
* (PECL memcache >= 0.2.0)<br/>
* Stores an item var with key on the memcached server. Parameter expire is expiration time in seconds.
* If it's 0, the item never expires (but memcached server doesn't guarantee this item to be stored all the time,
* it could be deleted from the cache to make place for other items).
* You can use MEMCACHE_COMPRESSED constant as flag value if you want to use on-the-fly compression (uses zlib).
* @link http://php.net/manual/en/memcache.set.php
* @param string $key The key that will be associated with the item.
* @param mixed $var The variable to store. Strings and integers are stored as is, other types are stored serialized.
* @param int $flag [optional] Use MEMCACHE_COMPRESSED to store the item compressed (uses zlib).
* @param int $expire [optional] Expiration time of the item. If it's equal to zero, the item will never expire. You can also use Unix timestamp or a number of seconds starting from current time, but in the latter case the number of seconds may not exceed 2592000 (30 days).
* @return boolean Returns <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
public function set ($key, $var, $flag, $expire) {}
/**
* (PECL memcache >= 0.2.0)<br/>
* Replace value of the existing item
* @link http://php.net/manual/en/memcache.replace.php
* @param string $key <p>The key that will be associated with the item.</p>
* @param mixed $var <p>The variable to store. Strings and integers are stored as is, other types are stored serialized.</p>
* @param int $flag [optional] <p>Use <b>MEMCACHE_COMPRESSED</b> to store the item compressed (uses zlib).</p>
* @param int $expire [optional] <p>Expiration time of the item. If it's equal to zero, the item will never expire. You can also use Unix timestamp or a number of seconds starting from current time, but in the latter case the number of seconds may not exceed 2592000 (30 days).</p>
* @return boolean Returns TRUE on success or FALSE on failure.
*/
public function replace ($key, $var, $flag, $expire) {}
public function cas () {}
public function append () {}
/**
* @return string
*/
public function prepend () {}
/**
* (PECL memcache >= 0.2.0)<br/>
* Retrieve item from the server
* @link http://php.net/manual/en/memcache.get.php
* @param string|array $key <p>
* The key or array of keys to fetch.
* </p>
* @param int|array $flags [optional] <p>
* If present, flags fetched along with the values will be written to this parameter. These
* flags are the same as the ones given to for example {@link http://php.net/manual/en/memcache.set.php Memcache::set()}.
* The lowest byte of the int is reserved for pecl/memcache internal usage (e.g. to indicate
* compression and serialization status).
* </p>
* @return string|array <p>
* Returns the string associated with the <b>key</b> or
* an array of found key-value pairs when <b>key</b> is an {@link http://php.net/manual/en/language.types.array.php array}.
* Returns <b>FALSE</b> on failure, <b>key</b> is not found or
* <b>key</b> is an empty {@link http://php.net/manual/en/language.types.array.php array}.
* </p>
*/
public function get ($key, &$flags) {}
/**
* (PECL memcache >= 0.2.0)<br/>
* Delete item from the server
* http://php.net/manual/ru/memcache.delete.php
* @param $key string The key associated with the item to delete.
* @param $timeout int [optional] This deprecated parameter is not supported, and defaults to 0 seconds. Do not use this parameter.
* @return boolean Returns <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
public function delete ($key, $timeout = 0 ) {}
/**
* (PECL memcache >= 0.2.0)<br/>
* Get statistics of the server
* @link http://php.net/manual/ru/memcache.getstats.php
* @param string $type [optional] <p>
* The type of statistics to fetch.
* Valid values are {reset, malloc, maps, cachedump, slabs, items, sizes}.
* According to the memcached protocol spec these additional arguments "are subject to change for the convenience of memcache developers".</p>
* @param int $slabid [optional] <p>
* Used in conjunction with <b>type</b> set to
* cachedump to identify the slab to dump from. The cachedump
* command ties up the server and is strictly to be used for
* debugging purposes.
* </p>
* @param int $limit [optional] <p>
* Used in conjunction with <b>type</b> set to cachedump to limit the number of entries to dump.
* </p>
* @return array|bool Returns an associative array of server statistics or <b>FALSE</b> on failure.
*/
public function getstats ($type, $slabid, $limit = 100) {}
/**
* (PECL memcache >= 2.0.0)<br/>
* Get statistics from all servers in pool
* @link http://php.net/manual/en/memcache.getextendedstats.php
* @param string $type [optional] <p>The type of statistics to fetch. Valid values are {reset, malloc, maps, cachedump, slabs, items, sizes}. According to the memcached protocol spec these additional arguments "are subject to change for the convenience of memcache developers".</p>
* @param int $slabid [optional] <p>
* Used in conjunction with <b>type</b> set to
* cachedump to identify the slab to dump from. The cachedump
* command ties up the server and is strictly to be used for
* debugging purposes.
* </p>
* @return array|boolean
* Returns a two-dimensional associative array of server statistics or <b>FALSE</b>
* on failure.
*/
public function getextendedstats ($type, $slabid, $limit = 100) {}
/**
* (PECL memcache >= 2.0.0)<br/>
* Enable automatic compression of large values
* @link http://php.net/manual/en/memcache.setcompressthreshold.php
* @param int $thresold <p>Controls the minimum value length before attempting to compress automatically.</p>
* @param float $min_saving [optional] <p>Specifies the minimum amount of savings to actually store the value compressed. The supplied value must be between 0 and 1. Default value is 0.2 giving a minimum 20% compression savings.</p>
* @return boolean Returns <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
public function setCompressThreshold ($thresold, $min_saving = 0.2) {}
/**
* (PECL memcache >= 0.2.0)<br/>
* Increment item's value
* @link http://php.net/manual/en/memcache.increment.php
* @param $key string Key of the item to increment.
* @param $value int [optional] increment the item by <b>value</b>
* @return boolean Returns <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
public function increment ($key, $value = 1) {}
/**
* (PECL memcache >= 0.2.0)<br/>
* Decrement item's value
* @link http://php.net/manual/en/memcache.decrement.php
* @param $key string Key of the item do decrement.
* @param $value int Decrement the item by <b>value</b>.
* @return int Returns item's new value on success or <b>FALSE</b> on failure.
*/
public function decrement ($key, $value = 1) {}
/**
* (PECL memcache >= 0.4.0)<br/>
* Close memcached server connection
* @link http://php.net/manual/en/memcache.close.php
* @return boolean Returns <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
public function close () {}
/**
* (PECL memcache >= 1.0.0)<br/>
* Flush all existing items at the server
* @link http://php.net/manual/en/memcache.flush.php
* @return boolean Returns <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
public function flush () {}
}
/**
* 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.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 ($host, $port, $timeout = 1) {}
}
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 () {}
function memcache_get () {}
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 ($on_off) {}
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 () {}
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.8
?>