1 | <?php |
||
17 | class ApcProxy implements ProxyInterface |
||
18 | { |
||
19 | /** |
||
20 | * @var AbstractAdapter |
||
21 | */ |
||
22 | protected $adapter; |
||
23 | |||
24 | /** |
||
25 | * {@inheritdoc} |
||
26 | */ |
||
27 | public function getFunctions() |
||
53 | |||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | */ |
||
57 | public function setAdapter(AbstractAdapter $adapter) |
||
61 | |||
62 | /** |
||
63 | * Caches a variable in the data store, only if it's not already stored |
||
64 | * |
||
65 | * Note: Unlike many other mechanisms in PHP, variables stored using apc_add() will persist between requests |
||
66 | * (until the value is removed from the cache). |
||
67 | * |
||
68 | * @since 3.0.13 |
||
69 | * @param mixed $key Store the variable using this name. keys are cache-unique, so attempting to use apc_add() to |
||
70 | * store data with a key that already exists will not overwrite the existing data, and will |
||
71 | * instead return FALSE. (This is the only difference between apc_add() and apc_store().) |
||
72 | * If $key is an array set Names in key, variables in value |
||
73 | * @param mixed $var The variable to store |
||
74 | * If $key is an array, this parameter is unused and set to NULL |
||
75 | * @param int $ttl Time To Live; store var in the cache for ttl seconds. After the ttl has passed, the stored |
||
76 | * variable will be expunged from the cache (on the next request). If no ttl is supplied |
||
77 | * (or if the ttl is 0), the value will persist until it is removed from the cache manually, |
||
78 | * or otherwise fails to exist in the cache (clear, restart, etc.). |
||
79 | * @return mixed |
||
80 | */ |
||
81 | public function apc_add($key, $var = null, $ttl = 0) |
||
97 | |||
98 | /** |
||
99 | * Get a binary dump of the given files and user variables |
||
100 | * |
||
101 | * Returns a binary dump of the given files and user variables from the APC cache. A NULL for files or user_vars |
||
102 | * signals a dump of every entry, whereas array() will dump nothing |
||
103 | * |
||
104 | * @since 3.1.4 |
||
105 | * @param mixed $files The files. Passing in NULL signals a dump of every entry, while passing in array() will |
||
106 | * dump nothing. |
||
107 | * @param mixed $user_vars The user vars. Passing in NULL signals a dump of every entry, while passing in array() |
||
108 | * will dump nothing. |
||
109 | * @return mixed Returns a binary dump of the given files and user variables from the APC cache, FALSE if |
||
110 | * APC is not enabled, or NULL if an unknown error is encountered. |
||
111 | */ |
||
112 | public function apc_bin_dump(array $files = null, $user_vars = null) |
||
123 | |||
124 | /** |
||
125 | * Outputs a binary dump of the given files and user variables from the APC cache to the named file. |
||
126 | * |
||
127 | * @since 3.1.4 |
||
128 | * @param array $files The file names being dumped |
||
129 | * @param array $user_vars The user variables being dumped |
||
130 | * @param string $filename The filename where the dump is being saved |
||
131 | * @param integer $flags Flags passed to the filename stream. See the file_put_contents() documentation for |
||
132 | * details. |
||
133 | * @param resource $context The context passed to the filename stream. See the file_put_contents() documentation |
||
134 | * for details. |
||
135 | * @return integer The number of bytes written to the file, otherwise FALSE if APC is not enabled, |
||
136 | * filename is an invalid file name, filename can't be opened, the file dump can't be |
||
137 | * completed (e.g., the hard drive is out of disk space), or an unknown error was |
||
138 | * encountered. |
||
139 | */ |
||
140 | public function apc_bin_dumpfile(array $files, array $user_vars, $filename, $flags = 0, $context = null) |
||
154 | |||
155 | /** |
||
156 | * Loads the given binary dump into the APC file/user cache |
||
157 | * |
||
158 | * @since 3.1.4 |
||
159 | * @param string $data The binary dump being loaded, likely from apc_bin_dump(). |
||
160 | * @param integer $flags Either APC_BIN_VERIFY_CRC32, APC_BIN_VERIFY_MD5, or both. |
||
161 | * @return boolean Returns TRUE if the binary dump data was loaded with success, otherwise FALSE is returned. |
||
162 | * FALSE is returned if APC is not enabled, or if the data is not a valid APC binary dump (e.g., unexpected size) |
||
163 | */ |
||
164 | public function apc_bin_load($data, $flags = 0) |
||
175 | |||
176 | /** |
||
177 | * Load a binary dump from a file into the APC file/user cache |
||
178 | * |
||
179 | * @since 3.1.4 |
||
180 | * @param string $filename The file name containing the dump, likely from apc_bin_dumpfile(). |
||
181 | * @param resource $context The files context. |
||
182 | * @param integer $flags Either APC_BIN_VERIFY_CRC32, APC_BIN_VERIFY_MD5, or both. |
||
183 | * @return boolean Returns TRUE on success, otherwise FALSE Reasons it may return FALSE include APC is not |
||
184 | * enabled, filename is an invalid file name or empty, filename can't be opened, the file |
||
185 | * dump can't be completed, or if the data is not a valid APC binary dump (e.g., |
||
186 | * unexpected size). |
||
187 | */ |
||
188 | public function apc_bin_loadfile($filename, $context = null, $flags = 0) |
||
200 | |||
201 | /** |
||
202 | * Updates an old value with a new value |
||
203 | * apc_cas() updates an already existing integer value if the old parameter matches the currently stored value with the value of the new parameter. |
||
204 | * |
||
205 | * @since 3.1.1 |
||
206 | * @param string $key The key of the value being updated. |
||
207 | * @param int $old The old value (the value currently stored). |
||
208 | * @param int $new The new value to update to |
||
209 | * @return boolean Returns TRUE on success or FALSE on failure. |
||
210 | */ |
||
211 | public function apc_cas($key, $old, $new) |
||
223 | |||
224 | /** |
||
225 | * Retrieves cached information from APC's data store |
||
226 | * |
||
227 | * @since 2.0.0 |
||
228 | * @param string $cache_type If cache_type is "user", information about the user cache will be returned. |
||
229 | * If cache_type is "filehits", information about which files have been served from the |
||
230 | * bytecode cache for the current request will be returned. This feature must be enabled |
||
231 | * at compile time using --enable-filehits . |
||
232 | * If an invalid or no cache_type is specified, information about the system cache |
||
233 | * (cached files) will be returned. |
||
234 | * @param boolean $limited If limited is TRUE, the return value will exclude the individual list of cache |
||
235 | * entries. This is useful when trying to optimize calls for statistics gathering. |
||
236 | * @return boolean Array of cached data (and meta-data) or FALSE on failure |
||
237 | */ |
||
238 | public function apc_cache_info($cache_type = "", $limited = false) |
||
249 | |||
250 | /** |
||
251 | * Clears the user/system cache |
||
252 | * |
||
253 | * @since 2.0.0 |
||
254 | * @param string $cache_type If cache_type is "user", the user cache will be cleared; otherwise, the system cache |
||
255 | * (cached files) will be cleared. |
||
256 | * @return boolean Always returns true |
||
257 | */ |
||
258 | public function apc_clear_cache($cache_type = "") |
||
268 | |||
269 | /** |
||
270 | * Stores a file in the bytecode cache, bypassing all filters. |
||
271 | * |
||
272 | * @since 3.0.13 |
||
273 | * @param string $filename Full or relative path to a PHP file that will be compiled and stored in the bytecode cache. |
||
274 | * @param boolean $atomic defaults to true |
||
275 | * @return boolean Returns TRUE on success or FALSE on failure |
||
276 | */ |
||
277 | public function apc_compile_file($filename, $atomic = true) |
||
288 | |||
289 | /** |
||
290 | * Decrease a stored number |
||
291 | * |
||
292 | * @since 3.1.1 |
||
293 | * @param string $key The key of the value being decreased. |
||
294 | * @param int $step The step, or value to decrease. |
||
295 | * @param \stdClass $ref success is set to TRUE in success and FALSE in failure |
||
296 | * @return mixed Returns the current value of key's value on success, or FALSE on failure |
||
297 | */ |
||
298 | public function apc_dec($key, $step = 1, $ref = false) |
||
317 | |||
318 | /** |
||
319 | * Defines a set of constants for retrieval and mass-definition |
||
320 | * |
||
321 | * define() is notoriously slow. Since the main benefit of APC is to increase the performance of |
||
322 | * scripts/applications, this mechanism is provided to streamline the process of mass constant definition. However, |
||
323 | * this function does not perform as well as anticipated. |
||
324 | * |
||
325 | * @since 3.0.0 |
||
326 | * @param string $key The key serves as the name of the constant set being stored. This key is used to |
||
327 | * retrieve the stored constants in apc_load_constants(). |
||
328 | * @param array $constants An associative array of constant_name => value pairs. The constant_name must |
||
329 | * follow the normal constant naming rules. value must evaluate to a scalar value. |
||
330 | * @param boolean $case_sensitive The default behaviour for constants is to be declared case-sensitive; i.e. |
||
331 | * CONSTANT and Constant represent different values. If this parameter evaluates to |
||
332 | * FALSE the constants will be declared as case-insensitive symbols. |
||
333 | * @return boolean Returns TRUE on success or FALSE on failure. |
||
334 | */ |
||
335 | public function apc_define_constants($key, array $constants, $case_sensitive = true) |
||
347 | |||
348 | /** |
||
349 | * Deletes files from the opcode cache |
||
350 | * |
||
351 | * @since 3.1.1 |
||
352 | * @param mixed $keys The files to be deleted. Accepts a string, array of strings, or an APCIterator object. |
||
353 | * @return mixed Returns TRUE on success or FALSE on failure. Or if keys is an array, then an empty array is |
||
354 | * returned on success, or an array of failed files is returned. |
||
355 | */ |
||
356 | public function apc_delete_file($keys) |
||
366 | |||
367 | /** |
||
368 | * Removes a stored variable from the cache |
||
369 | * |
||
370 | * @since 3.1.1 |
||
371 | * @param mixed $key The key used to store the value (with apc_store()). |
||
372 | * @return mixed Returns TRUE on success or FALSE on failure. |
||
373 | */ |
||
374 | public function apc_delete($key) |
||
384 | |||
385 | /** |
||
386 | * Checks if one or more APC keys exist. |
||
387 | * |
||
388 | * @since 3.1.4 |
||
389 | * @param mixed $keys A string, or an array of strings, that contain keys. |
||
390 | * @return mixed Returns TRUE if the key exists, otherwise FALSE Or if an array was passed to keys, then an |
||
391 | * array is returned that contains all existing keys, or an empty array if none exist. |
||
392 | */ |
||
393 | public function apc_exists($keys) |
||
403 | |||
404 | /** |
||
405 | * Fetch a stored variable from the cache |
||
406 | * |
||
407 | * @since 3.0.0 |
||
408 | * @param mixed $key The key used to store the value (with apc_store()). If an array is passed then each element is fetched and returned. |
||
409 | * @param \stdClass $ref success is set to TRUE in success and FALSE in failure |
||
410 | * @return mixed The stored variable or array of variables on success; FALSE on failure |
||
411 | */ |
||
412 | public function apc_fetch($key, $ref = false) |
||
427 | |||
428 | /** |
||
429 | * Increase a stored number |
||
430 | * |
||
431 | * @since 3.1.1 |
||
432 | * @param string $key The key of the value being increased. |
||
433 | * @param int $step The step, or value to increased. |
||
434 | * @param \stdClass $ref success is set to TRUE in success and FALSE in failure |
||
435 | * @return mixed Returns the current value of key's value on success, or FALSE on failure |
||
436 | */ |
||
437 | public function apc_inc($key, $step = 1, $ref = false) |
||
456 | |||
457 | /** |
||
458 | * Loads a set of constants from the cache |
||
459 | * |
||
460 | * @since 3.0.0 |
||
461 | * @param mixed $key The name of the constant set (that was stored with apc_define_constants()) to be |
||
462 | * retrieved. |
||
463 | * @param boolean $case_sensitive The default behaviour for constants is to be declared case-sensitive; i.e. |
||
464 | * CONSTANT and Constant represent different values. If this parameter evaluates to |
||
465 | * FALSE the constants will be declared as case-insensitive symbols. |
||
466 | * @return boolean Returns TRUE on success or FALSE on failure |
||
467 | */ |
||
468 | public function apc_load_constants($key, $case_sensitive = true) |
||
479 | |||
480 | /** |
||
481 | * Retrieves APC's Shared Memory Allocation information |
||
482 | * |
||
483 | * @since 2.0.0 |
||
484 | * @param boolean $limited When set to FALSE (default) apc_sma_info() will return a detailed information about |
||
485 | * each segment. |
||
486 | * @return boolean Array of Shared Memory Allocation data; FALSE on failure |
||
487 | */ |
||
488 | public function apc_sma_info($limited = false) |
||
498 | |||
499 | /** |
||
500 | * Cache a variable in the data store |
||
501 | * |
||
502 | * Note: Unlike many other mechanisms in PHP, variables stored using apc_store() will persist between requests |
||
503 | * (until the value is removed from the cache). |
||
504 | * |
||
505 | * @since 3.0.0 |
||
506 | * @param mixed $key Store the variable using this name. keys are cache-unique, so storing a second value with the |
||
507 | * same key will overwrite the original value. |
||
508 | * If $key is an array set Names in key, variables in value |
||
509 | * @param mixed $var The variable to store |
||
510 | * If $key is an array, this parameter is unused and set to NULL |
||
511 | * @param int $ttl Time To Live; store var in the cache for ttl seconds. After the ttl has passed, the stored |
||
512 | * variable will be expunged from the cache (on the next request). If no ttl is supplied (or if |
||
513 | * the ttl is 0), the value will persist until it is removed from the cache manually, or |
||
514 | * otherwise fails to exist in the cache (clear, restart, etc.). |
||
515 | * @return boolean Returns TRUE on success or FALSE on failure. Second syntax returns array with error keys. |
||
516 | */ |
||
517 | public function apc_store($key, $var = null, $ttl = 0) |
||
533 | |||
534 | /** |
||
535 | * @return string |
||
536 | */ |
||
537 | public function apc_version() |
||
544 | } |
||
545 |