Total Complexity | 7 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | class APCUCache extends Common implements CacheInterface |
||
19 | { |
||
20 | /** |
||
21 | 2 | * {@inheritDoc} |
|
22 | */ |
||
23 | 2 | public function get($key, $default = null) |
|
29 | } |
||
30 | |||
31 | 5 | /** |
|
32 | * {@inheritDoc} |
||
33 | 5 | */ |
|
34 | 3 | public function set($key, $value, $ttl = null): bool |
|
35 | 1 | { |
|
36 | $this->checkReservedCharacters($key); |
||
37 | 3 | if ($ttl instanceof DateInterval) { |
|
38 | $ttl = (new DateTime('now'))->add($ttl)->getTimeStamp() - time(); |
||
39 | } |
||
40 | |||
41 | return apcu_store($key, $value, (int) $ttl); |
||
|
|||
42 | } |
||
43 | 2 | ||
44 | /** |
||
45 | 2 | * {@inheritDoc} |
|
46 | 2 | */ |
|
47 | public function delete($key): bool |
||
52 | 6 | } |
|
53 | |||
54 | 6 | public function clear(): bool |
|
55 | { |
||
56 | return apcu_clear_cache(); |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | 1 | * {@inheritDoc} |
|
61 | */ |
||
62 | 1 | public function has($key) |
|
67 | } |
||
68 | } |
||
69 |