| Total Complexity | 8 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | final class APCu extends AbstractAdapter |
||
| 11 | { |
||
| 12 | private function __construct() |
||
| 13 | { |
||
| 14 | Assertions::assertExtensionLoaded('apcu'); |
||
| 15 | ini_set('apc.use_request_time', '0'); |
||
| 16 | } |
||
| 17 | |||
| 18 | public static function create(): SimpleCache\CacheInterface |
||
| 21 | } |
||
| 22 | |||
| 23 | public function flush(): bool |
||
| 24 | { |
||
| 25 | return \apcu_clear_cache(); |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @inheritDoc |
||
| 30 | * @psalm-suppress InvalidArgument MoreSpecificImplementedParamType |
||
| 31 | */ |
||
| 32 | protected function multiGet(array $keys, $default = null): \Generator |
||
| 33 | { |
||
| 34 | $results = \apcu_fetch($keys); |
||
| 35 | foreach ($keys as $key) { |
||
| 36 | yield $key => $results[$key] ?? $default; |
||
| 37 | } |
||
| 38 | } |
||
| 39 | |||
| 40 | protected function multiSave(array $values, int $ttl = null): bool |
||
| 45 | } |
||
| 46 | |||
| 47 | protected function multiDelete(array $keys): bool |
||
| 48 | { |
||
| 49 | return \apcu_delete(new \APCUIterator($keys)); |
||
|
|
|||
| 50 | } |
||
| 51 | |||
| 52 | protected function exists(string $key): bool |
||
| 55 | } |
||
| 56 | } |
||
| 57 |