1
0

apc.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <?
  2. /**
  3. * Stubs for APC 3.1.4
  4. *
  5. * Author: Johnny Woo
  6. * Date: Aug 9, 2010
  7. * Time: 12:19:14 PM
  8. */
  9. /**
  10. * @link http://php.net/manual/en/apc.constants.php
  11. */
  12. define('APC_LIST_ACTIVE', 1);
  13. /**
  14. * @link http://php.net/manual/en/apc.constants.php
  15. */
  16. define('APC_LIST_DELETED', 2);
  17. /**
  18. * @link http://php.net/manual/en/apc.constants.php
  19. */
  20. define('APC_ITER_TYPE', 1);
  21. /**
  22. * @link http://php.net/manual/en/apc.constants.php
  23. */
  24. define('APC_ITER_KEY', 2);
  25. /**
  26. * @link http://php.net/manual/en/apc.constants.php
  27. */
  28. define('APC_ITER_FILENAME', 4);
  29. /**
  30. * @link http://php.net/manual/en/apc.constants.php
  31. */
  32. define('APC_ITER_DEVICE', 8);
  33. /**
  34. * @link http://php.net/manual/en/apc.constants.php
  35. */
  36. define('APC_ITER_INODE', 16);
  37. /**
  38. * @link http://php.net/manual/en/apc.constants.php
  39. */
  40. define('APC_ITER_VALUE', 32);
  41. /**
  42. * @link http://php.net/manual/en/apc.constants.php
  43. */
  44. define('APC_ITER_MD5', 64);
  45. /**
  46. * @link http://php.net/manual/en/apc.constants.php
  47. */
  48. define('APC_ITER_NUM_HITS', 128);
  49. /**
  50. * @link http://php.net/manual/en/apc.constants.php
  51. */
  52. define('APC_ITER_MTIME', 256);
  53. /**
  54. * @link http://php.net/manual/en/apc.constants.php
  55. */
  56. define('APC_ITER_CTIME', 512);
  57. /**
  58. * @link http://php.net/manual/en/apc.constants.php
  59. */
  60. define('APC_ITER_DTIME', 1024);
  61. /**
  62. * @link http://php.net/manual/en/apc.constants.php
  63. */
  64. define('APC_ITER_ATIME', 2048);
  65. /**
  66. * @link http://php.net/manual/en/apc.constants.php
  67. */
  68. define('APC_ITER_REFCOUNT', 4096);
  69. /**
  70. * @link http://php.net/manual/en/apc.constants.php
  71. */
  72. define('APC_ITER_MEM_SIZE', 8192);
  73. /**
  74. * @link http://php.net/manual/en/apc.constants.php
  75. */
  76. define('APC_ITER_TTL', 16384);
  77. /**
  78. * @link http://php.net/manual/en/apc.constants.php
  79. */
  80. define('APC_ITER_NONE', 0);
  81. /**
  82. * @link http://php.net/manual/en/apc.constants.php
  83. */
  84. define('APC_ITER_ALL', -1);
  85. /**
  86. * @link http://php.net/manual/en/apc.constants.php
  87. */
  88. define('APC_BIN_VERIFY_MD5', 1);
  89. /**
  90. * @link http://php.net/manual/en/apc.constants.php
  91. */
  92. define('APC_BIN_VERIFY_CRC32', 2);
  93. /**
  94. * Retrieves cached information and meta-data from APC's data store
  95. * @link http://php.net/manual/en/function.apc-cache-info.php
  96. * @param string $type If cache_type is "user", information about the user cache will be returned.
  97. * If cache_type is "filehits", information about which files have been served from the bytecode
  98. * cache for the current request will be returned. This feature must be enabled at compile time
  99. * using --enable-filehits. If an invalid or no cache_type is specified, information about the
  100. * system cache (cached files) will be returned.
  101. * @param bool $limited If limited is TRUE, the return value will exclude the individual list
  102. * of cache entries. This is useful when trying to optimize calls for statistics gathering.
  103. * @return array|bool Array of cached data (and meta-data) or FALSE on failure.
  104. */
  105. function apc_cache_info($type = '', $limited = false){}
  106. /**
  107. * Clears the APC cache
  108. * @link http://php.net/manual/en/function.apc-clear-cache.php
  109. * @param string $cache_type If cache_type is "user", the user cache will be cleared;
  110. * otherwise, the system cache (cached files) will be cleared.
  111. * @return bool Returns TRUE on success or FALSE on failure.
  112. */
  113. function apc_clear_cache($cache_type = ''){}
  114. /**
  115. * Retrieves APC's Shared Memory Allocation information
  116. * @link http://php.net/manual/en/function.apc-sma-info.php
  117. * @param bool $limited When set to FALSE (default) apc_sma_info() will
  118. * return a detailed information about each segment.
  119. * @return array|bool Array of Shared Memory Allocation data; FALSE on failure.
  120. */
  121. function apc_sma_info($limited = false){}
  122. /**
  123. * Cache a variable in the data store
  124. * @link http://php.net/manual/en/function.apc-store.php
  125. * @param string|array $key String: Store the variable using this name. Keys are cache-unique,
  126. * so storing a second value with the same key will overwrite the original value.
  127. * Array: Names in key, variables in value.
  128. * @param mixed $var [optional] The variable to store
  129. * @param int $ttl [optional] Time To Live; store var in the cache for ttl seconds. After the ttl has passed,
  130. * the stored variable will be expunged from the cache (on the next request). If no ttl is supplied
  131. * (or if the ttl is 0), the value will persist until it is removed from the cache manually,
  132. * or otherwise fails to exist in the cache (clear, restart, etc.).
  133. * @return bool|array Returns TRUE on success or FALSE on failure | array with error keys.
  134. */
  135. function apc_store($key, $var, $ttl = 0){}
  136. /**
  137. * Fetch a stored variable from the cache
  138. * @link http://php.net/manual/en/function.apc-fetch.php
  139. * @param string|string[] $key The key used to store the value (with apc_store()).
  140. * If an array is passed then each element is fetched and returned.
  141. * @param bool $success Set to TRUE in success and FALSE in failure.
  142. * @return mixed The stored variable or array of variables on success; FALSE on failure.
  143. */
  144. function apc_fetch($key, &$success = null){}
  145. /**
  146. * Removes a stored variable from the cache
  147. * @link http://php.net/manual/en/function.apc-delete.php
  148. * @param string|string[]|APCIterator $key The key used to store the value (with apc_store()).
  149. * @return bool|string[] Returns TRUE on success or FALSE on failure. For array of keys returns list of failed keys.
  150. */
  151. function apc_delete($key){}
  152. /**
  153. * Defines a set of constants for retrieval and mass-definition
  154. *
  155. * define() is notoriously slow. Since the main benefit of APC is to increase
  156. * the performance of scripts/applications, this mechanism is provided to streamline
  157. * the process of mass constant definition. However, this function does not perform
  158. * as well as anticipated. For a better-performing solution, try the hidef extension from PECL.
  159. *
  160. * @link http://php.net/manual/en/function.apc-define-constants.php
  161. * @param string $key The key serves as the name of the constant set being stored.
  162. * This key is used to retrieve the stored constants in apc_load_constants().
  163. * @param array $constants An associative array of constant_name => value pairs.
  164. * The constant_name must follow the normal constant naming rules. Value must evaluate to a scalar value.
  165. * @param bool $case_sensitive The default behaviour for constants is to be declared case-sensitive;
  166. * i.e. CONSTANT and Constant represent different values. If this parameter evaluates to FALSE
  167. * the constants will be declared as case-insensitive symbols.
  168. * @return bool Returns TRUE on success or FALSE on failure.
  169. */
  170. function apc_define_constants($key, array $constants, $case_sensitive = true){}
  171. /**
  172. * Caches a variable in the data store, only if it's not already stored
  173. * @link http://php.net/manual/en/function.apc-add.php
  174. * @param string $key Store the variable using this name. Keys are cache-unique,
  175. * so attempting to use apc_add() to store data with a key that already exists will not
  176. * overwrite the existing data, and will instead return FALSE. (This is the only difference
  177. * between apc_add() and apc_store().)
  178. * @param mixed $var The variable to store
  179. * @param int $ttl Time To Live; store var in the cache for ttl seconds. After the ttl has passed,
  180. * the stored variable will be expunged from the cache (on the next request). If no ttl is supplied
  181. * (or if the ttl is 0), the value will persist until it is removed from the cache manually,
  182. * or otherwise fails to exist in the cache (clear, restart, etc.).
  183. * @return bool
  184. */
  185. function apc_add($key, $var, $ttl = 0){}
  186. /**
  187. * Stores a file in the bytecode cache, bypassing all filters
  188. * @link http://php.net/manual/en/function.apc-compile-file.php
  189. * @param string|string[] $filename Full or relative path to a PHP file that will be
  190. * compiled and stored in the bytecode cache.
  191. * @param bool $atomic
  192. * @return bool Returns TRUE on success or FALSE on failure.
  193. */
  194. function apc_compile_file($filename, $atomic = true){}
  195. /**
  196. * Loads a set of constants from the cache
  197. * @link http://php.net/manual/en/function.apc-load-constants.php
  198. * @param string $key The name of the constant set (that was stored
  199. * with apc_define_constants()) to be retrieved.
  200. * @param bool $case_sensitive The default behaviour for constants is to be declared case-sensitive;
  201. * i.e. CONSTANT and Constant represent different values. If this parameter evaluates to FALSE
  202. * the constants will be declared as case-insensitive symbols.
  203. * @return bool Returns TRUE on success or FALSE on failure.
  204. */
  205. function apc_load_constants($key, $case_sensitive = true){}
  206. /**
  207. * Checks if APC key exists
  208. * @link http://php.net/manual/en/function.apc-exists.php
  209. * @param bool|string[] $keys A string, or an array of strings, that contain keys.
  210. * @return bool|string[] Returns TRUE if the key exists, otherwise FALSE
  211. * Or if an array was passed to keys, then an array is returned that
  212. * contains all existing keys, or an empty array if none exist.
  213. */
  214. function apc_exists($keys){}
  215. /**
  216. * Deletes the given files from the opcode cache
  217. *
  218. * Accepts a string, array of strings, or APCIterator object.
  219. * Returns True/False, or for an Array an Array of failed files.
  220. *
  221. * @link http://php.net/manual/en/function.apc-delete-file.php
  222. * @param string|string[]|APCIterator $keys
  223. * @return bool|string[]
  224. */
  225. function apc_delete_file($keys){}
  226. /**
  227. * Increase a stored number
  228. * @link http://php.net/manual/en/function.apc-inc.php
  229. * @param string $key The key of the value being increased.
  230. * @param int $step The step, or value to increase.
  231. * @param bool $success Optionally pass the success or fail boolean value to this referenced variable.
  232. * @return int|bool Returns the current value of key's value on success, or FALSE on failure.
  233. */
  234. function apc_inc($key, $step = 1, &$success = null){}
  235. /**
  236. * Decrease a stored number
  237. * @link http://php.net/manual/en/function.apc-dec.php
  238. * @param string $key The key of the value being decreased.
  239. * @param int $step The step, or value to decrease.
  240. * @param bool $success Optionally pass the success or fail boolean value to this referenced variable.
  241. * @return int|bool Returns the current value of key's value on success, or FALSE on failure.
  242. */
  243. function apc_dec($key, $step = 1, &$success = null){}
  244. /**
  245. * @link http://php.net/manual/en/function.apc-cas.php
  246. * @param string $key
  247. * @param int $old
  248. * @param int $new
  249. * @return bool
  250. */
  251. function apc_cas($key, $old, $new){}
  252. /**
  253. * Returns a binary dump of the given files and user variables from the APC cache
  254. *
  255. * A NULL for files or user_vars signals a dump of every entry, while array() will dump nothing.
  256. *
  257. * @link http://php.net/manual/en/function.apc-bin-dump.php
  258. * @param string[]|null $files The files. Passing in NULL signals a dump of every entry, while passing in array() will dump nothing.
  259. * @param string[]|null $user_vars The user vars. Passing in NULL signals a dump of every entry, while passing in array() will dump nothing.
  260. * @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.
  261. */
  262. function apc_bin_dump($files = null, $user_vars = null){}
  263. /**
  264. * Output a binary dump of the given files and user variables from the APC cache to the named file
  265. * @link http://php.net/manual/en/function.apc-bin-dumpfile.php
  266. * @param string[]|null $files The file names being dumped.
  267. * @param string[]|null $user_vars The user variables being dumped.
  268. * @param string $filename The filename where the dump is being saved.
  269. * @param int $flags Flags passed to the filename stream. See the file_put_contents() documentation for details.
  270. * @param resource $context The context passed to the filename stream. See the file_put_contents() documentation for details.
  271. * @return int|bool The number of bytes written to the file, otherwise FALSE if APC
  272. * is not enabled, filename is an invalid file name, filename can't be opened,
  273. * the file dump can't be completed (e.g., the hard drive is out of disk space),
  274. * or an unknown error was encountered.
  275. */
  276. function apc_bin_dumpfile($files, $user_vars, $filename, $flags = 0, $context = null){}
  277. /**
  278. * Load the given binary dump into the APC file/user cache
  279. * @link http://php.net/manual/en/function.apc-bin-load.php
  280. * @param string $data The binary dump being loaded, likely from apc_bin_dump().
  281. * @param int $flags Either APC_BIN_VERIFY_CRC32, APC_BIN_VERIFY_MD5, or both.
  282. * @return bool Returns TRUE if the binary dump data was loaded with success, otherwise FALSE is returned.
  283. * FALSE is returned if APC is not enabled, or if the data is not a valid APC binary dump (e.g., unexpected size).
  284. */
  285. function apc_bin_load($data, $flags = 0){}
  286. /**
  287. * Load the given binary dump from the named file into the APC file/user cache
  288. * @link http://php.net/manual/en/function.apc-bin-loadfile.php
  289. * @param string $filename The file name containing the dump, likely from apc_bin_dumpfile().
  290. * @param resource $context The files context.
  291. * @param int $flags Either APC_BIN_VERIFY_CRC32, APC_BIN_VERIFY_MD5, or both.
  292. * @return bool Returns TRUE on success, otherwise FALSE Reasons it may return FALSE include APC
  293. * is not enabled, filename is an invalid file name or empty, filename can't be opened,
  294. * the file dump can't be completed, or if the data is not a valid APC binary dump (e.g., unexpected size).
  295. */
  296. function apc_bin_loadfile($filename, $context = null, $flags = 0){}