| Total Complexity | 4 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | class Apcu implements Storing |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * @param string $key |
||
| 17 | * @return bool |
||
| 18 | */ |
||
| 19 | public function has(string $key) : bool |
||
| 20 | { |
||
| 21 | return apcu_exists($key); |
||
|
|
|||
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @param string $key |
||
| 26 | * @return mixed |
||
| 27 | */ |
||
| 28 | public function read(string $key) |
||
| 29 | { |
||
| 30 | return apcu_fetch($key); |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @param string $key |
||
| 35 | * @param mixed $data |
||
| 36 | * @param int $ttl |
||
| 37 | * @return bool |
||
| 38 | */ |
||
| 39 | public function write(string $key, $data, int $ttl = null) : bool |
||
| 40 | { |
||
| 41 | return apcu_store($key, $data, $ttl ?? 0); |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @param string $key |
||
| 46 | * @return bool |
||
| 47 | */ |
||
| 48 | public function remove(string $key) : bool |
||
| 51 | } |
||
| 52 | } |
||
| 53 |