1 | <?php |
||
17 | class ApcuProxy implements ProxyInterface |
||
18 | { |
||
19 | /** |
||
20 | * @var AbstractAdapter |
||
21 | */ |
||
22 | protected $adapter; |
||
23 | |||
24 | /** |
||
25 | * {@inheritdoc} |
||
26 | */ |
||
27 | 1 | public function getFunctions() |
|
45 | |||
46 | /** |
||
47 | * {@inheritdoc} |
||
48 | */ |
||
49 | 2 | public function setAdapter(AbstractAdapter $adapter) |
|
53 | |||
54 | /** |
||
55 | * Caches a variable in the data store, only if it's not already stored |
||
56 | * |
||
57 | * Note: Unlike many other mechanisms in PHP, variables stored using apcu_add() will persist between requests |
||
58 | * (until the value is removed from the cache). |
||
59 | * |
||
60 | * @since 3.0.13 |
||
61 | * @param mixed $key Store the variable using this name. keys are cache-unique, so attempting to use apc_add() to |
||
62 | * store data with a key that already exists will not overwrite the existing data, and will |
||
63 | * instead return FALSE. (This is the only difference between apcu_add() and apc_store().) |
||
64 | * If $key is an array set Names in key, variables in value |
||
65 | * @param mixed $var The variable to store |
||
66 | * If $key is an array, this parameter is unused and set to NULL |
||
67 | * @param int $ttl Time To Live; store var in the cache for ttl seconds. After the ttl has passed, the stored |
||
68 | * variable will be expunged from the cache (on the next request). If no ttl is supplied |
||
69 | * (or if the ttl is 0), the value will persist until it is removed from the cache manually, |
||
70 | * or otherwise fails to exist in the cache (clear, restart, etc.). |
||
71 | * @return mixed |
||
72 | */ |
||
73 | 2 | public function apcu_add($key, $var = null, $ttl = 0) |
|
89 | |||
90 | /** |
||
91 | * Updates an old value with a new value |
||
92 | * apcu_cas() updates an already existing integer value if the old parameter matches the currently stored value with the value of the new parameter. |
||
93 | * |
||
94 | * @since 3.1.1 |
||
95 | * @param string $key The key of the value being updated. |
||
96 | * @param int $old The old value (the value currently stored). |
||
97 | * @param int $new The new value to update to |
||
98 | * @return boolean Returns TRUE on success or FALSE on failure. |
||
99 | */ |
||
100 | 1 | public function apcu_cas($key, $old, $new) |
|
112 | |||
113 | /** |
||
114 | * Retrieves cached information from APCu's data store |
||
115 | * |
||
116 | * @since 2.0.0 |
||
117 | * @param boolean $limited If limited is TRUE, the return value will exclude the individual list of cache |
||
118 | * entries. This is useful when trying to optimize calls for statistics gathering. |
||
119 | * @return boolean Array of cached data (and meta-data) or FALSE on failure |
||
120 | */ |
||
121 | 1 | public function apcu_cache_info($limited = false) |
|
131 | |||
132 | /** |
||
133 | * Clears the user/system cache |
||
134 | * |
||
135 | * @since 2.0.0 |
||
136 | * @return boolean Always returns true |
||
137 | */ |
||
138 | public function apcu_clear_cache() |
||
145 | |||
146 | /** |
||
147 | * Decrease a stored number |
||
148 | * |
||
149 | * @since 3.1.1 |
||
150 | * @param string $key The key of the value being decreased. |
||
151 | * @param int $step The step, or value to decrease. |
||
152 | * @param \stdClass $ref success is set to TRUE in success and FALSE in failure |
||
153 | * @return mixed Returns the current value of key's value on success, or FALSE on failure |
||
154 | */ |
||
155 | 1 | public function apcu_dec($key, $step = 1, $ref = false) |
|
174 | |||
175 | /** |
||
176 | * Removes a stored variable from the cache |
||
177 | * |
||
178 | * @since 3.1.1 |
||
179 | * @param mixed $key The key used to store the value (with apcu_store()). |
||
180 | * @return mixed Returns TRUE on success or FALSE on failure. |
||
181 | */ |
||
182 | 1 | public function apcu_delete($key) |
|
192 | |||
193 | /** |
||
194 | * Checks if one or more APCu keys exist. |
||
195 | * |
||
196 | * @since 3.1.4 |
||
197 | * @param mixed $keys A string, or an array of strings, that contain keys. |
||
198 | * @return mixed Returns TRUE if the key exists, otherwise FALSE Or if an array was passed to keys, then an |
||
199 | * array is returned that contains all existing keys, or an empty array if none exist. |
||
200 | */ |
||
201 | 1 | public function apcu_exists($keys) |
|
211 | |||
212 | /** |
||
213 | * Fetch a stored variable from the cache |
||
214 | * |
||
215 | * @since 3.0.0 |
||
216 | * @param mixed $key The key used to store the value (with apcu_store()). If an array is passed then each element is fetched and returned. |
||
217 | * @param \stdClass $ref success is set to TRUE in success and FALSE in failure |
||
218 | * @return mixed The stored variable or array of variables on success; FALSE on failure |
||
219 | */ |
||
220 | 1 | public function apcu_fetch($key, $ref = false) |
|
235 | |||
236 | /** |
||
237 | * Increase a stored number |
||
238 | * |
||
239 | * @since 3.1.1 |
||
240 | * @param string $key The key of the value being increased. |
||
241 | * @param int $step The step, or value to increased. |
||
242 | * @param \stdClass $ref success is set to TRUE in success and FALSE in failure |
||
243 | * @return mixed Returns the current value of key's value on success, or FALSE on failure |
||
244 | */ |
||
245 | 1 | public function apcu_inc($key, $step = 1, $ref = false) |
|
264 | |||
265 | /** |
||
266 | * Retrieves APCu's Shared Memory Allocation information |
||
267 | * |
||
268 | * @since 2.0.0 |
||
269 | * @param boolean $limited When set to FALSE (default) apcu_sma_info() will return a detailed information about |
||
270 | * each segment. |
||
271 | * @return boolean Array of Shared Memory Allocation data; FALSE on failure |
||
272 | */ |
||
273 | 1 | public function apcu_sma_info($limited = false) |
|
283 | |||
284 | /** |
||
285 | * Cache a variable in the data store |
||
286 | * |
||
287 | * Note: Unlike many other mechanisms in PHP, variables stored using apcu_store() will persist between requests |
||
288 | * (until the value is removed from the cache). |
||
289 | * |
||
290 | * @since 3.0.0 |
||
291 | * @param mixed $key Store the variable using this name. keys are cache-unique, so storing a second value with the |
||
292 | * same key will overwrite the original value. |
||
293 | * If $key is an array set Names in key, variables in value |
||
294 | * @param mixed $var The variable to store |
||
295 | * If $key is an array, this parameter is unused and set to NULL |
||
296 | * @param int $ttl Time To Live; store var in the cache for ttl seconds. After the ttl has passed, the stored |
||
297 | * variable will be expunged from the cache (on the next request). If no ttl is supplied (or if |
||
298 | * the ttl is 0), the value will persist until it is removed from the cache manually, or |
||
299 | * otherwise fails to exist in the cache (clear, restart, etc.). |
||
300 | * @return boolean Returns TRUE on success or FALSE on failure. Second syntax returns array with error keys. |
||
301 | */ |
||
302 | 1 | public function apcu_store($key, $var = null, $ttl = 0) |
|
314 | |||
315 | /** |
||
316 | * @return string |
||
317 | */ |
||
318 | 1 | public function apcu_version() |
|
325 | } |
||
326 |