1
0

apcu.php 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  1. <?php
  2. /**
  3. * Stubs for APC (apcu_bc nowadays) extension
  4. */
  5. /**
  6. * @link https://php.net/manual/en/apc.constants.php
  7. */
  8. define('APC_BIN_VERIFY_MD5', 1);
  9. /**
  10. * @link https://php.net/manual/en/apc.constants.php
  11. */
  12. define('APC_BIN_VERIFY_CRC32', 2);
  13. /**
  14. * Retrieves cached information and meta-data from APC's data store
  15. * @link https://php.net/manual/en/function.apc-cache-info.php
  16. * @param string $type If cache_type is "user", information about the user cache will be returned.
  17. * If cache_type is "filehits", information about which files have been served from the bytecode
  18. * cache for the current request will be returned. This feature must be enabled at compile time
  19. * using --enable-filehits. If an invalid or no cache_type is specified, information about the
  20. * system cache (cached files) will be returned.
  21. * @param bool $limited If limited is TRUE, the return value will exclude the individual list
  22. * of cache entries. This is useful when trying to optimize calls for statistics gathering.
  23. * @return array|bool Array of cached data (and meta-data) or FALSE on failure.
  24. */
  25. function apc_cache_info($type = '', $limited = false){}
  26. /**
  27. * Clears the APC cache
  28. * @link https://php.net/manual/en/function.apc-clear-cache.php
  29. * @param string $cache_type If cache_type is "user", the user cache will be cleared;
  30. * otherwise, the system cache (cached files) will be cleared.
  31. * @return bool Returns TRUE on success or FALSE on failure.
  32. */
  33. function apc_clear_cache($cache_type = ''){}
  34. /**
  35. * Retrieves APC's Shared Memory Allocation information
  36. * @link https://php.net/manual/en/function.apc-sma-info.php
  37. * @param bool $limited When set to FALSE (default) apc_sma_info() will
  38. * return a detailed information about each segment.
  39. * @return array|bool Array of Shared Memory Allocation data; FALSE on failure.
  40. */
  41. function apc_sma_info($limited = false){}
  42. /**
  43. * Cache a variable in the data store
  44. * @link https://php.net/manual/en/function.apc-store.php
  45. * @param string|array $key String: Store the variable using this name. Keys are cache-unique,
  46. * so storing a second value with the same key will overwrite the original value.
  47. * Array: Names in key, variables in value.
  48. * @param mixed $var [optional] The variable to store
  49. * @param int $ttl [optional] Time To Live; store var in the cache for ttl seconds. After the ttl has passed,
  50. * the stored variable will be expunged from the cache (on the next request). If no ttl is supplied
  51. * (or if the ttl is 0), the value will persist until it is removed from the cache manually,
  52. * or otherwise fails to exist in the cache (clear, restart, etc.).
  53. * @return bool|array Returns TRUE on success or FALSE on failure | array with error keys.
  54. */
  55. function apc_store($key, $var, $ttl = 0){}
  56. /**
  57. * Fetch a stored variable from the cache
  58. * @link https://php.net/manual/en/function.apc-fetch.php
  59. * @param string|string[] $key The key used to store the value (with apc_store()).
  60. * If an array is passed then each element is fetched and returned.
  61. * @param bool $success Set to TRUE in success and FALSE in failure.
  62. * @return mixed The stored variable or array of variables on success; FALSE on failure.
  63. */
  64. function apc_fetch($key, &$success = null){}
  65. /**
  66. * Removes a stored variable from the cache
  67. * @link https://php.net/manual/en/function.apc-delete.php
  68. * @param string|string[]|APCIterator $key The key used to store the value (with apc_store()).
  69. * @return bool|string[] Returns TRUE on success or FALSE on failure. For array of keys returns list of failed keys.
  70. */
  71. function apc_delete($key){}
  72. /**
  73. * Defines a set of constants for retrieval and mass-definition
  74. *
  75. * define() is notoriously slow. Since the main benefit of APC is to increase
  76. * the performance of scripts/applications, this mechanism is provided to streamline
  77. * the process of mass constant definition. However, this function does not perform
  78. * as well as anticipated. For a better-performing solution, try the hidef extension from PECL.
  79. *
  80. * @link https://php.net/manual/en/function.apc-define-constants.php
  81. * @param string $key The key serves as the name of the constant set being stored.
  82. * This key is used to retrieve the stored constants in apc_load_constants().
  83. * @param array $constants An associative array of constant_name => value pairs.
  84. * The constant_name must follow the normal constant naming rules. Value must evaluate to a scalar value.
  85. * @param bool $case_sensitive The default behaviour for constants is to be declared case-sensitive;
  86. * i.e. CONSTANT and Constant represent different values. If this parameter evaluates to FALSE
  87. * the constants will be declared as case-insensitive symbols.
  88. * @return bool Returns TRUE on success or FALSE on failure.
  89. */
  90. function apc_define_constants($key, array $constants, $case_sensitive = true){}
  91. /**
  92. * Caches a variable in the data store, only if it's not already stored
  93. * @link https://php.net/manual/en/function.apc-add.php
  94. * @param string $key Store the variable using this name. Keys are cache-unique,
  95. * so attempting to use apc_add() to store data with a key that already exists will not
  96. * overwrite the existing data, and will instead return FALSE. (This is the only difference
  97. * between apc_add() and apc_store().)
  98. * @param mixed $var The variable to store
  99. * @param int $ttl Time To Live; store var in the cache for ttl seconds. After the ttl has passed,
  100. * the stored variable will be expunged from the cache (on the next request). If no ttl is supplied
  101. * (or if the ttl is 0), the value will persist until it is removed from the cache manually,
  102. * or otherwise fails to exist in the cache (clear, restart, etc.).
  103. * @return bool
  104. */
  105. function apc_add($key, $var, $ttl = 0){}
  106. /**
  107. * Stores a file in the bytecode cache, bypassing all filters
  108. * @link https://php.net/manual/en/function.apc-compile-file.php
  109. * @param string|string[] $filename Full or relative path to a PHP file that will be
  110. * compiled and stored in the bytecode cache.
  111. * @param bool $atomic
  112. * @return bool Returns TRUE on success or FALSE on failure.
  113. */
  114. function apc_compile_file($filename, $atomic = true){}
  115. /**
  116. * Loads a set of constants from the cache
  117. * @link https://php.net/manual/en/function.apc-load-constants.php
  118. * @param string $key The name of the constant set (that was stored
  119. * with apc_define_constants()) to be retrieved.
  120. * @param bool $case_sensitive The default behaviour for constants is to be declared case-sensitive;
  121. * i.e. CONSTANT and Constant represent different values. If this parameter evaluates to FALSE
  122. * the constants will be declared as case-insensitive symbols.
  123. * @return bool Returns TRUE on success or FALSE on failure.
  124. */
  125. function apc_load_constants($key, $case_sensitive = true){}
  126. /**
  127. * Checks if APC key exists
  128. * @link https://php.net/manual/en/function.apc-exists.php
  129. * @param bool|string[] $keys A string, or an array of strings, that contain keys.
  130. * @return bool|string[] Returns TRUE if the key exists, otherwise FALSE
  131. * Or if an array was passed to keys, then an array is returned that
  132. * contains all existing keys, or an empty array if none exist.
  133. */
  134. function apc_exists($keys){}
  135. /**
  136. * Deletes the given files from the opcode cache
  137. *
  138. * Accepts a string, array of strings, or APCIterator object.
  139. * Returns True/False, or for an Array an Array of failed files.
  140. *
  141. * @link https://php.net/manual/en/function.apc-delete-file.php
  142. * @param string|string[]|APCIterator $keys
  143. * @return bool|string[]
  144. */
  145. function apc_delete_file($keys){}
  146. /**
  147. * Increase a stored number
  148. * @link https://php.net/manual/en/function.apc-inc.php
  149. * @param string $key The key of the value being increased.
  150. * @param int $step The step, or value to increase.
  151. * @param bool $success Optionally pass the success or fail boolean value to this referenced variable.
  152. * @return int|bool Returns the current value of key's value on success, or FALSE on failure.
  153. */
  154. function apc_inc($key, $step = 1, &$success = null){}
  155. /**
  156. * Decrease a stored number
  157. * @link https://php.net/manual/en/function.apc-dec.php
  158. * @param string $key The key of the value being decreased.
  159. * @param int $step The step, or value to decrease.
  160. * @param bool $success Optionally pass the success or fail boolean value to this referenced variable.
  161. * @return int|bool Returns the current value of key's value on success, or FALSE on failure.
  162. */
  163. function apc_dec($key, $step = 1, &$success = null){}
  164. /**
  165. * @link https://php.net/manual/en/function.apc-cas.php
  166. * @param string $key
  167. * @param int $old
  168. * @param int $new
  169. * @return bool
  170. */
  171. function apc_cas($key, $old, $new){}
  172. /**
  173. * Returns a binary dump of the given files and user variables from the APC cache
  174. *
  175. * A NULL for files or user_vars signals a dump of every entry, while array() will dump nothing.
  176. *
  177. * @link https://php.net/manual/en/function.apc-bin-dump.php
  178. * @param string[]|null $files The files. Passing in NULL signals a dump of every entry, while passing in array() will dump nothing.
  179. * @param string[]|null $user_vars The user vars. Passing in NULL signals a dump of every entry, while passing in array() will dump nothing.
  180. * @return string|bool|null Returns a binary dump of the given files and user variables from the APC cache, FALSE if APC is not enabled, or NULL if an unknown error is encountered.
  181. */
  182. function apc_bin_dump($files = null, $user_vars = null){}
  183. /**
  184. * Output a binary dump of the given files and user variables from the APC cache to the named file
  185. * @link https://php.net/manual/en/function.apc-bin-dumpfile.php
  186. * @param string[]|null $files The file names being dumped.
  187. * @param string[]|null $user_vars The user variables being dumped.
  188. * @param string $filename The filename where the dump is being saved.
  189. * @param int $flags Flags passed to the filename stream. See the file_put_contents() documentation for details.
  190. * @param resource $context The context passed to the filename stream. See the file_put_contents() documentation for details.
  191. * @return int|bool The number of bytes written to the file, otherwise FALSE if APC
  192. * is not enabled, filename is an invalid file name, filename can't be opened,
  193. * the file dump can't be completed (e.g., the hard drive is out of disk space),
  194. * or an unknown error was encountered.
  195. */
  196. function apc_bin_dumpfile($files, $user_vars, $filename, $flags = 0, $context = null){}
  197. /**
  198. * Load the given binary dump into the APC file/user cache
  199. * @link https://php.net/manual/en/function.apc-bin-load.php
  200. * @param string $data The binary dump being loaded, likely from apc_bin_dump().
  201. * @param int $flags Either APC_BIN_VERIFY_CRC32, APC_BIN_VERIFY_MD5, or both.
  202. * @return bool Returns TRUE if the binary dump data was loaded with success, otherwise FALSE is returned.
  203. * FALSE is returned if APC is not enabled, or if the data is not a valid APC binary dump (e.g., unexpected size).
  204. */
  205. function apc_bin_load($data, $flags = 0){}
  206. /**
  207. * Load the given binary dump from the named file into the APC file/user cache
  208. * @link https://php.net/manual/en/function.apc-bin-loadfile.php
  209. * @param string $filename The file name containing the dump, likely from apc_bin_dumpfile().
  210. * @param resource $context The files context.
  211. * @param int $flags Either APC_BIN_VERIFY_CRC32, APC_BIN_VERIFY_MD5, or both.
  212. * @return bool Returns TRUE on success, otherwise FALSE Reasons it may return FALSE include APC
  213. * is not enabled, filename is an invalid file name or empty, filename can't be opened,
  214. * the file dump can't be completed, or if the data is not a valid APC binary dump (e.g., unexpected size).
  215. */
  216. function apc_bin_loadfile($filename, $context = null, $flags = 0){}
  217. /**
  218. * The APCIterator class
  219. *
  220. * The APCIterator class makes it easier to iterate over large APC caches.
  221. * This is helpful as it allows iterating over large caches in steps, while grabbing a defined number
  222. * of entries per lock instance, so it frees the cache locks for other activities rather than hold up
  223. * the entire cache to grab 100 (the default) entries. Also, using regular expression matching is more
  224. * efficient as it's been moved to the C level.
  225. *
  226. * @link https://php.net/manual/en/class.apciterator.php
  227. */
  228. class APCIterator implements Iterator
  229. {
  230. /**
  231. * Constructs an APCIterator iterator object
  232. * @link https://php.net/manual/en/apciterator.construct.php
  233. * @param string $cache The cache type, which will be 'user' or 'file'.
  234. * @param string|string[]|null $search A PCRE regular expression that matches against APC key names,
  235. * either as a string for a single regular expression, or as an array of regular expressions.
  236. * Or, optionally pass in NULL to skip the search.
  237. * @param int $format The desired format, as configured with one ore more of the APC_ITER_* constants.
  238. * @param int $chunk_size The chunk size. Must be a value greater than 0. The default value is 100.
  239. * @param int $list The type to list. Either pass in APC_LIST_ACTIVE or APC_LIST_INACTIVE.
  240. */
  241. public function __construct($cache, $search = null, $format = APC_ITER_ALL, $chunk_size = 100, $list = APC_LIST_ACTIVE){}
  242. /**
  243. * Rewinds back the iterator to the first element
  244. * @link https://php.net/manual/en/apciterator.rewind.php
  245. */
  246. public function rewind(){}
  247. /**
  248. * Checks if the current iterator position is valid
  249. * @link https://php.net/manual/en/apciterator.valid.php
  250. * @return bool Returns TRUE if the current iterator position is valid, otherwise FALSE.
  251. */
  252. public function valid(){}
  253. /**
  254. * Gets the current item from the APCIterator stack
  255. * @link https://php.net/manual/en/apciterator.current.php
  256. * @return mixed Returns the current item on success, or FALSE if no more items or exist, or on failure.
  257. */
  258. public function current(){}
  259. /**
  260. * Gets the current iterator key
  261. * @link https://php.net/manual/en/apciterator.key.php
  262. * @return string|int|bool Returns the key on success, or FALSE upon failure.
  263. */
  264. public function key(){}
  265. /**
  266. * Moves the iterator pointer to the next element
  267. * @link https://php.net/manual/en/apciterator.next.php
  268. * @return bool Returns TRUE on success or FALSE on failure.
  269. */
  270. public function next(){}
  271. /**
  272. * Gets the total number of cache hits
  273. * @link https://php.net/manual/en/apciterator.gettotalhits.php
  274. * @return int|bool The number of hits on success, or FALSE on failure.
  275. */
  276. public function getTotalHits(){}
  277. /**
  278. * Gets the total cache size
  279. * @link https://php.net/manual/en/apciterator.gettotalsize.php
  280. * @return int|bool The total cache size.
  281. */
  282. public function getTotalSize(){}
  283. /**
  284. * Get the total count
  285. * @link https://php.net/manual/en/apciterator.gettotalcount.php
  286. * @return int|bool The total count.
  287. */
  288. public function getTotalCount(){}
  289. }
  290. /**
  291. * Stubs for APCu 5.0.0
  292. */
  293. /**
  294. * @link https://php.net/manual/en/apcu.constants.php
  295. */
  296. define('APC_LIST_ACTIVE', 1);
  297. /**
  298. * @link https://php.net/manual/en/apcu.constants.php
  299. */
  300. define('APC_LIST_DELETED', 2);
  301. /**
  302. * @link https://php.net/manual/en/apcu.constants.php
  303. */
  304. define('APC_ITER_TYPE', 1);
  305. /**
  306. * @link https://php.net/manual/en/apcu.constants.php
  307. */
  308. define('APC_ITER_KEY', 2);
  309. /**
  310. * @link https://php.net/manual/en/apcu.constants.php
  311. */
  312. define('APC_ITER_FILENAME', 4);
  313. /**
  314. * @link https://php.net/manual/en/apcu.constants.php
  315. */
  316. define('APC_ITER_DEVICE', 8);
  317. /**
  318. * @link https://php.net/manual/en/apcu.constants.php
  319. */
  320. define('APC_ITER_INODE', 16);
  321. /**
  322. * @link https://php.net/manual/en/apcu.constants.php
  323. */
  324. define('APC_ITER_VALUE', 32);
  325. /**
  326. * @link https://php.net/manual/en/apcu.constants.php
  327. */
  328. define('APC_ITER_MD5', 64);
  329. /**
  330. * @link https://php.net/manual/en/apcu.constants.php
  331. */
  332. define('APC_ITER_NUM_HITS', 128);
  333. /**
  334. * @link https://php.net/manual/en/apcu.constants.php
  335. */
  336. define('APC_ITER_MTIME', 256);
  337. /**
  338. * @link https://php.net/manual/en/apcu.constants.php
  339. */
  340. define('APC_ITER_CTIME', 512);
  341. /**
  342. * @link https://php.net/manual/en/apcu.constants.php
  343. */
  344. define('APC_ITER_DTIME', 1024);
  345. /**
  346. * @link https://php.net/manual/en/apcu.constants.php
  347. */
  348. define('APC_ITER_ATIME', 2048);
  349. /**
  350. * @link https://php.net/manual/en/apcu.constants.php
  351. */
  352. define('APC_ITER_REFCOUNT', 4096);
  353. /**
  354. * @link https://php.net/manual/en/apcu.constants.php
  355. */
  356. define('APC_ITER_MEM_SIZE', 8192);
  357. /**
  358. * @link https://php.net/manual/en/apcu.constants.php
  359. */
  360. define('APC_ITER_TTL', 16384);
  361. /**
  362. * @link https://php.net/manual/en/apcu.constants.php
  363. */
  364. define('APC_ITER_NONE', 0);
  365. /**
  366. * @link https://php.net/manual/en/apcu.constants.php
  367. */
  368. define('APC_ITER_ALL', -1);
  369. /**
  370. * Clears the APCu cache
  371. * @link https://php.net/manual/en/function.apcu-clear-cache.php
  372. *
  373. * @return bool Returns TRUE always.
  374. */
  375. function apcu_clear_cache(){}
  376. /**
  377. * Retrieves APCu Shared Memory Allocation information
  378. * @link https://php.net/manual/en/function.apcu-sma-info.php
  379. * @param bool $limited When set to FALSE (default) apcu_sma_info() will
  380. * return a detailed information about each segment.
  381. *
  382. * @return array|false Array of Shared Memory Allocation data; FALSE on failure.
  383. */
  384. function apcu_sma_info($limited = false){}
  385. /**
  386. * Cache a variable in the data store
  387. * @link https://php.net/manual/en/function.apcu-store.php
  388. * @param string|array $key String: Store the variable using this name. Keys are cache-unique,
  389. * so storing a second value with the same key will overwrite the original value.
  390. * Array: Names in key, variables in value.
  391. * @param mixed $var [optional] The variable to store
  392. * @param int $ttl [optional] Time To Live; store var in the cache for ttl seconds. After the ttl has passed,
  393. * the stored variable will be expunged from the cache (on the next request). If no ttl is supplied
  394. * (or if the ttl is 0), the value will persist until it is removed from the cache manually,
  395. * or otherwise fails to exist in the cache (clear, restart, etc.).
  396. * @return bool|array Returns TRUE on success or FALSE on failure | array with error keys.
  397. */
  398. function apcu_store($key, $var, $ttl = 0){}
  399. /**
  400. * Fetch a stored variable from the cache
  401. * @link https://php.net/manual/en/function.apcu-fetch.php
  402. * @param string|string[] $key The key used to store the value (with apcu_store()).
  403. * If an array is passed then each element is fetched and returned.
  404. * @param bool $success Set to TRUE in success and FALSE in failure.
  405. * @return mixed The stored variable or array of variables on success; FALSE on failure.
  406. */
  407. function apcu_fetch($key, &$success = null){}
  408. /**
  409. * Removes a stored variable from the cache
  410. * @link https://php.net/manual/en/function.apcu-delete.php
  411. * @param string|string[]|APCuIterator $key The key used to store the value (with apcu_store()).
  412. * @return bool|string[] Returns TRUE on success or FALSE on failure. For array of keys returns list of failed keys.
  413. */
  414. function apcu_delete($key){}
  415. /**
  416. * Caches a variable in the data store, only if it's not already stored
  417. * @link https://php.net/manual/en/function.apcu-add.php
  418. * @param string|array $key Store the variable using this name. Keys are cache-unique,
  419. * so attempting to use apcu_add() to store data with a key that already exists will not
  420. * overwrite the existing data, and will instead return FALSE. (This is the only difference
  421. * between apcu_add() and apcu_store().)
  422. * Array: Names in key, variables in value.
  423. * @param mixed $var The variable to store
  424. * @param int $ttl Time To Live; store var in the cache for ttl seconds. After the ttl has passed,
  425. * the stored variable will be expunged from the cache (on the next request). If no ttl is supplied
  426. * (or if the ttl is 0), the value will persist until it is removed from the cache manually,
  427. * or otherwise fails to exist in the cache (clear, restart, etc.).
  428. * @return bool|array Returns TRUE if something has effectively been added into the cache, FALSE otherwise.
  429. * Second syntax returns array with error keys.
  430. */
  431. function apcu_add($key, $var, $ttl = 0){}
  432. /**
  433. * Checks if APCu key exists
  434. * @link https://php.net/manual/en/function.apcu-exists.php
  435. * @param string|string[] $keys A string, or an array of strings, that contain keys.
  436. * @return bool|string[] Returns TRUE if the key exists, otherwise FALSE
  437. * Or if an array was passed to keys, then an array is returned that
  438. * contains all existing keys, or an empty array if none exist.
  439. */
  440. function apcu_exists($keys){}
  441. /**
  442. * Increase a stored number
  443. * @link https://php.net/manual/en/function.apcu-inc.php
  444. * @param string $key The key of the value being increased.
  445. * @param int $step The step, or value to increase.
  446. * @param int $ttl Time To Live; store var in the cache for ttl seconds. After the ttl has passed,
  447. * the stored variable will be expunged from the cache (on the next request). If no ttl is supplied
  448. * (or if the ttl is 0), the value will persist until it is removed from the cache manually,
  449. * or otherwise fails to exist in the cache (clear, restart, etc.).
  450. * @param bool $success Optionally pass the success or fail boolean value to this referenced variable.
  451. * @return int|false Returns the current value of key's value on success, or FALSE on failure.
  452. */
  453. function apcu_inc($key, $step = 1, &$success = null, $ttl = 0){}
  454. /**
  455. * Decrease a stored number
  456. * @link https://php.net/manual/en/function.apcu-dec.php
  457. * @param string $key The key of the value being decreased.
  458. * @param int $step The step, or value to decrease.
  459. * @param int $ttl Time To Live; store var in the cache for ttl seconds. After the ttl has passed,
  460. * the stored variable will be expunged from the cache (on the next request). If no ttl is supplied
  461. * (or if the ttl is 0), the value will persist until it is removed from the cache manually,
  462. * or otherwise fails to exist in the cache (clear, restart, etc.).
  463. * @param bool $success Optionally pass the success or fail boolean value to this referenced variable.
  464. * @return int|false Returns the current value of key's value on success, or FALSE on failure.
  465. */
  466. function apcu_dec($key, $step = 1, &$success = null, $ttl = 0){}
  467. /**
  468. * Updates an old value with a new value
  469. *
  470. * apcu_cas() updates an already existing integer value if the old parameter matches the currently stored value
  471. * with the value of the new parameter.
  472. *
  473. * @link https://php.net/manual/en/function.apcu-cas.php
  474. * @param string $key The key of the value being updated.
  475. * @param int $old The old value (the value currently stored).
  476. * @param int $new The new value to update to.
  477. * @return bool Returns TRUE on success or FALSE on failure.
  478. */
  479. function apcu_cas($key, $old, $new){}
  480. /**
  481. * Atomically fetch or generate a cache entry
  482. *
  483. * <p>Atomically attempts to find key in the cache, if it cannot be found generator is called,
  484. * passing key as the only argument. The return value of the call is then cached with the optionally
  485. * specified ttl, and returned.
  486. * </p>
  487. *
  488. * <p>Note: When control enters <i>apcu_entry()</i> the lock for the cache is acquired exclusively, it is released when
  489. * control leaves apcu_entry(): In effect, this turns the body of generator into a critical section,
  490. * disallowing two processes from executing the same code paths concurrently.
  491. * In addition, it prohibits the concurrent execution of any other APCu functions,
  492. * since they will acquire the same lock.
  493. * </p>
  494. *
  495. * @link https://php.net/manual/en/function.apcu-entry.php
  496. *
  497. * @param string $key Identity of cache entry
  498. * @param callable $generator A callable that accepts key as the only argument and returns the value to cache.
  499. * <p>Warning
  500. * The only APCu function that can be called safely by generator is apcu_entry().</p>
  501. * @param int $ttl [optional] Time To Live; store var in the cache for ttl seconds.
  502. * After the ttl has passed, the stored variable will be expunged from the cache (on the next request).
  503. * If no ttl is supplied (or if the ttl is 0), the value will persist until it is removed from the cache manually,
  504. * or otherwise fails to exist in the cache (clear, restart, etc.).
  505. * @return mixed Returns the cached value
  506. * @since APCu 5.1.0
  507. */
  508. function apcu_entry($key, callable $generator, $ttl = 0){}
  509. /**
  510. * Retrieves cached information from APCu's data store
  511. *
  512. * @link https://php.net/manual/en/function.apcu-cache-info.php
  513. *
  514. * @param bool $limited If limited is TRUE, the return value will exclude the individual list of cache entries.
  515. * This is useful when trying to optimize calls for statistics gathering.
  516. * @return array|false Array of cached data (and meta-data) or FALSE on failure
  517. */
  518. function apcu_cache_info($limited = false){}
  519. /**
  520. * Whether APCu is usable in the current environment
  521. *
  522. * @link https://www.php.net/manual/en/function.apcu-enabled.php
  523. *
  524. * @return bool
  525. */
  526. function apcu_enabled(){}
  527. /**
  528. * @param string $key
  529. */
  530. function apcu_key_info($key){}
  531. /**
  532. * The APCuIterator class
  533. *
  534. * The APCuIterator class makes it easier to iterate over large APCu caches.
  535. * This is helpful as it allows iterating over large caches in steps, while grabbing a defined number
  536. * of entries per lock instance, so it frees the cache locks for other activities rather than hold up
  537. * the entire cache to grab 100 (the default) entries. Also, using regular expression matching is more
  538. * efficient as it's been moved to the C level.
  539. *
  540. * @link https://php.net/manual/en/class.apcuiterator.php
  541. * @since APCu 5.0.0
  542. */
  543. class APCuIterator implements Iterator
  544. {
  545. /**
  546. * Constructs an APCuIterator iterator object
  547. * @link https://php.net/manual/en/apcuiterator.construct.php
  548. * @param string|string[]|null $search A PCRE regular expression that matches against APCu key names,
  549. * either as a string for a single regular expression, or as an array of regular expressions.
  550. * Or, optionally pass in NULL to skip the search.
  551. * @param int $format The desired format, as configured with one ore more of the APC_ITER_* constants.
  552. * @param int $chunk_size The chunk size. Must be a value greater than 0. The default value is 100.
  553. * @param int $list The type to list. Either pass in APC_LIST_ACTIVE or APC_LIST_DELETED.
  554. */
  555. public function __construct($search = null, $format = APC_ITER_ALL, $chunk_size = 100, $list = APC_LIST_ACTIVE){}
  556. /**
  557. * Rewinds back the iterator to the first element
  558. * @link https://php.net/manual/en/apcuiterator.rewind.php
  559. */
  560. public function rewind(){}
  561. /**
  562. * Checks if the current iterator position is valid
  563. * @link https://php.net/manual/en/apcuiterator.valid.php
  564. * @return bool Returns TRUE if the current iterator position is valid, otherwise FALSE.
  565. */
  566. public function valid(){}
  567. /**
  568. * Gets the current item from the APCuIterator stack
  569. * @link https://php.net/manual/en/apcuiterator.current.php
  570. * @return mixed Returns the current item on success, or FALSE if no more items or exist, or on failure.
  571. */
  572. public function current(){}
  573. /**
  574. * Gets the current iterator key
  575. * @link https://php.net/manual/en/apcuiterator.key.php
  576. * @return string|int|false Returns the key on success, or FALSE upon failure.
  577. */
  578. public function key(){}
  579. /**
  580. * Moves the iterator pointer to the next element
  581. * @link https://php.net/manual/en/apcuiterator.next.php
  582. * @return bool Returns TRUE on success or FALSE on failure.
  583. */
  584. public function next(){}
  585. /**
  586. * Gets the total number of cache hits
  587. * @link https://php.net/manual/en/apcuiterator.gettotalhits.php
  588. * @return int|false The number of hits on success, or FALSE on failure.
  589. */
  590. public function getTotalHits(){}
  591. /**
  592. * Gets the total cache size
  593. * @link https://php.net/manual/en/apcuiterator.gettotalsize.php
  594. * @return int|false The total cache size.
  595. */
  596. public function getTotalSize(){}
  597. /**
  598. * Get the total count
  599. * @link https://php.net/manual/en/apcuiterator.gettotalcount.php
  600. * @return int|false The total count.
  601. */
  602. public function getTotalCount(){}
  603. }