You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

apcu.php 8.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <?php
  2. /**
  3. * Stubs for APCu 5.0.0
  4. */
  5. /**
  6. * @link http://php.net/manual/en/apcu.constants.php
  7. */
  8. define('APC_LIST_ACTIVE', 1);
  9. /**
  10. * @link http://php.net/manual/en/apcu.constants.php
  11. */
  12. define('APC_LIST_DELETED', 2);
  13. /**
  14. * @link http://php.net/manual/en/apcu.constants.php
  15. */
  16. define('APC_ITER_TYPE', 1);
  17. /**
  18. * @link http://php.net/manual/en/apcu.constants.php
  19. */
  20. define('APC_ITER_KEY', 2);
  21. /**
  22. * @link http://php.net/manual/en/apcu.constants.php
  23. */
  24. define('APC_ITER_FILENAME', 4);
  25. /**
  26. * @link http://php.net/manual/en/apcu.constants.php
  27. */
  28. define('APC_ITER_DEVICE', 8);
  29. /**
  30. * @link http://php.net/manual/en/apcu.constants.php
  31. */
  32. define('APC_ITER_INODE', 16);
  33. /**
  34. * @link http://php.net/manual/en/apcu.constants.php
  35. */
  36. define('APC_ITER_VALUE', 32);
  37. /**
  38. * @link http://php.net/manual/en/apcu.constants.php
  39. */
  40. define('APC_ITER_MD5', 64);
  41. /**
  42. * @link http://php.net/manual/en/apcu.constants.php
  43. */
  44. define('APC_ITER_NUM_HITS', 128);
  45. /**
  46. * @link http://php.net/manual/en/apcu.constants.php
  47. */
  48. define('APC_ITER_MTIME', 256);
  49. /**
  50. * @link http://php.net/manual/en/apcu.constants.php
  51. */
  52. define('APC_ITER_CTIME', 512);
  53. /**
  54. * @link http://php.net/manual/en/apcu.constants.php
  55. */
  56. define('APC_ITER_DTIME', 1024);
  57. /**
  58. * @link http://php.net/manual/en/apcu.constants.php
  59. */
  60. define('APC_ITER_ATIME', 2048);
  61. /**
  62. * @link http://php.net/manual/en/apcu.constants.php
  63. */
  64. define('APC_ITER_REFCOUNT', 4096);
  65. /**
  66. * @link http://php.net/manual/en/apcu.constants.php
  67. */
  68. define('APC_ITER_MEM_SIZE', 8192);
  69. /**
  70. * @link http://php.net/manual/en/apcu.constants.php
  71. */
  72. define('APC_ITER_TTL', 16384);
  73. /**
  74. * @link http://php.net/manual/en/apcu.constants.php
  75. */
  76. define('APC_ITER_NONE', 0);
  77. /**
  78. * @link http://php.net/manual/en/apcu.constants.php
  79. */
  80. define('APC_ITER_ALL', -1);
  81. /**
  82. * Clears the APCu cache
  83. * @link http://php.net/manual/en/function.apcu-clear-cache.php
  84. *
  85. * @return bool Returns TRUE always.
  86. */
  87. function apcu_clear_cache(){}
  88. /**
  89. * Retrieves APCu Shared Memory Allocation information
  90. * @link http://php.net/manual/en/function.apcu-sma-info.php
  91. * @param bool $limited When set to FALSE (default) apcu_sma_info() will
  92. * return a detailed information about each segment.
  93. *
  94. * @return array|bool Array of Shared Memory Allocation data; FALSE on failure.
  95. */
  96. function apcu_sma_info($limited = false){}
  97. /**
  98. * Cache a variable in the data store
  99. * @link http://php.net/manual/en/function.apcu-store.php
  100. * @param string|array $key String: Store the variable using this name. Keys are cache-unique,
  101. * so storing a second value with the same key will overwrite the original value.
  102. * Array: Names in key, variables in value.
  103. * @param mixed $var [optional] The variable to store
  104. * @param int $ttl [optional] Time To Live; store var in the cache for ttl seconds. After the ttl has passed,
  105. * the stored variable will be expunged from the cache (on the next request). If no ttl is supplied
  106. * (or if the ttl is 0), the value will persist until it is removed from the cache manually,
  107. * or otherwise fails to exist in the cache (clear, restart, etc.).
  108. * @return bool|array Returns TRUE on success or FALSE on failure | array with error keys.
  109. */
  110. function apcu_store($key, $var, $ttl = 0){}
  111. /**
  112. * Fetch a stored variable from the cache
  113. * @link http://php.net/manual/en/function.apcu-fetch.php
  114. * @param string|string[] $key The key used to store the value (with apcu_store()).
  115. * If an array is passed then each element is fetched and returned.
  116. * @param bool $success Set to TRUE in success and FALSE in failure.
  117. * @return mixed The stored variable or array of variables on success; FALSE on failure.
  118. */
  119. function apcu_fetch($key, &$success = null){}
  120. /**
  121. * Removes a stored variable from the cache
  122. * @link http://php.net/manual/en/function.apcu-delete.php
  123. * @param string|string[]|APCUIterator $key The key used to store the value (with apcu_store()).
  124. * @return bool|string[] Returns TRUE on success or FALSE on failure. For array of keys returns list of failed keys.
  125. */
  126. function apcu_delete($key){}
  127. /**
  128. * Caches a variable in the data store, only if it's not already stored
  129. * @link http://php.net/manual/en/function.apcu-add.php
  130. * @param string $key Store the variable using this name. Keys are cache-unique,
  131. * so attempting to use apcu_add() to store data with a key that already exists will not
  132. * overwrite the existing data, and will instead return FALSE. (This is the only difference
  133. * between apcu_add() and apcu_store().)
  134. * @param mixed $var The variable to store
  135. * @param int $ttl Time To Live; store var in the cache for ttl seconds. After the ttl has passed,
  136. * the stored variable will be expunged from the cache (on the next request). If no ttl is supplied
  137. * (or if the ttl is 0), the value will persist until it is removed from the cache manually,
  138. * or otherwise fails to exist in the cache (clear, restart, etc.).
  139. * @return bool
  140. */
  141. function apcu_add($key, $var, $ttl = 0){}
  142. /**
  143. * Checks if APCu key exists
  144. * @link http://php.net/manual/en/function.apcu-exists.php
  145. * @param string|string[] $keys A string, or an array of strings, that contain keys.
  146. * @return bool|string[] Returns TRUE if the key exists, otherwise FALSE
  147. * Or if an array was passed to keys, then an array is returned that
  148. * contains all existing keys, or an empty array if none exist.
  149. */
  150. function apcu_exists($keys){}
  151. /**
  152. * Increase a stored number
  153. * @link http://php.net/manual/en/function.apcu-inc.php
  154. * @param string $key The key of the value being increased.
  155. * @param int $step The step, or value to increase.
  156. * @param bool $success Optionally pass the success or fail boolean value to this referenced variable.
  157. * @return int|bool Returns the current value of key's value on success, or FALSE on failure.
  158. */
  159. function apcu_inc($key, $step = 1, &$success = null){}
  160. /**
  161. * Decrease a stored number
  162. * @link http://php.net/manual/en/function.apcu-dec.php
  163. * @param string $key The key of the value being decreased.
  164. * @param int $step The step, or value to decrease.
  165. * @param bool $success Optionally pass the success or fail boolean value to this referenced variable.
  166. * @return int|bool Returns the current value of key's value on success, or FALSE on failure.
  167. */
  168. function apcu_dec($key, $step = 1, &$success = null){}
  169. /**
  170. * Updates an old value with a new value
  171. *
  172. * apcu_cas() updates an already existing integer value if the old parameter matches the currently stored value
  173. * with the value of the new parameter.
  174. *
  175. * @link http://php.net/manual/en/function.apcu-cas.php
  176. * @param string $key The key of the value being updated.
  177. * @param int $old The old value (the value currently stored).
  178. * @param int $new The new value to update to.
  179. * @return bool Returns TRUE on success or FALSE on failure.
  180. */
  181. function apcu_cas($key, $old, $new){}
  182. /**
  183. * Atomically fetch or generate a cache entry
  184. *
  185. * <p>Atomically attempts to find key in the cache, if it cannot be found generator is called,
  186. * passing key as the only argument. The return value of the call is then cached with the optionally
  187. * specified ttl, and returned.
  188. * </p>
  189. *
  190. * <p>Note: When control enters <i>apcu_entry()</i> the lock for the cache is acquired exclusively, it is released when
  191. * control leaves apcu_entry(): In effect, this turns the body of generator into a critical section,
  192. * disallowing two processes from executing the same code paths concurrently.
  193. * In addition, it prohibits the concurrent execution of any other APCu functions,
  194. * since they will acquire the same lock.
  195. * </p>
  196. *
  197. * @link http://php.net/manual/en/function.apcu-entry.php
  198. *
  199. * @param string $key Identity of cache entry
  200. * @param callable $generator A callable that accepts key as the only argument and returns the value to cache.
  201. * <p>Warning
  202. * The only APCu function that can be called safely by generator is apcu_entry().</p>
  203. * @param int $ttl [optional] Time To Live; store var in the cache for ttl seconds.
  204. * After the ttl has passed, the stored variable will be expunged from the cache (on the next request).
  205. * If no ttl is supplied (or if the ttl is 0), the value will persist until it is removed from the cache manually,
  206. * or otherwise fails to exist in the cache (clear, restart, etc.).
  207. * @return mixed Returns the cached value
  208. * @since APCu 5.1.0
  209. */
  210. function apcu_entry($key, callable $generator, $ttl = 0){}
  211. /**
  212. * Retrieves cached information from APCu's data store
  213. *
  214. * @link http://php.net/manual/en/function.apcu-cache-info.php
  215. *
  216. * @param bool $limited If limited is TRUE, the return value will exclude the individual list of cache entries.
  217. * This is useful when trying to optimize calls for statistics gathering.
  218. * @return array|bool Array of cached data (and meta-data) or FALSE on failure
  219. */
  220. function apcu_cache_info($limited = false){}