| Name | Size | Mode | Actions |
|---|---|---|---|
| AbstractAdapter.php | 8327 | 0644 | editdlrm |
| AbstractTagAwareAdapter.php | 12537 | 0644 | editdlrm |
| AdapterInterface.php | 963 | 0644 | editdlrm |
| ApcuAdapter.php | 3959 | 0644 | editdlrm |
| ArrayAdapter.php | 11183 | 0644 | editdlrm |
| ChainAdapter.php | 8968 | 0644 | editdlrm |
| CouchbaseBucketAdapter.php | 7729 | 0644 | editdlrm |
| CouchbaseCollectionAdapter.php | 6705 | 0644 | editdlrm |
| DoctrineAdapter.php | 2845 | 0644 | editdlrm |
| DoctrineDbalAdapter.php | 15355 | 0644 | editdlrm |
| FilesystemAdapter.php | 933 | 0644 | editdlrm |
| FilesystemTagAwareAdapter.php | 7584 | 0644 | editdlrm |
| MemcachedAdapter.php | 13749 | 0644 | editdlrm |
| NullAdapter.php | 2657 | 0644 | editdlrm |
| ParameterNormalizer.php | 898 | 0644 | editdlrm |
| PdoAdapter.php | 20331 | 0644 | editdlrm |
| PhpArrayAdapter.php | 12537 | 0644 | editdlrm |
| PhpFilesAdapter.php | 10260 | 0644 | editdlrm |
| ProxyAdapter.php | 8469 | 0644 | editdlrm |
| Psr16Adapter.php | 1941 | 0644 | editdlrm |
| RedisAdapter.php | 1200 | 0644 | editdlrm |
| RedisTagAwareAdapter.php | 12218 | 0644 | editdlrm |
| TagAwareAdapter.php | 11387 | 0644 | editdlrm |
| TagAwareAdapterInterface.php | 775 | 0644 | editdlrm |
| TraceableAdapter.php | 6931 | 0644 | editdlrm |
| TraceableTagAwareAdapter.php | 932 | 0644 | editdlrm |
/usr/share/php/Symfony/Component/Cache/Adapter/ApcuAdapter.php (3959B)
*/ class ApcuAdapter extends AbstractAdapter { private $marshaller; /** * @throws CacheException if APCu is not enabled */ public function __construct(string $namespace = '', int $defaultLifetime = 0, string $version = null, MarshallerInterface $marshaller = null) { if (!static::isSupported()) { throw new CacheException('APCu is not enabled.'); } if ('cli' === \PHP_SAPI) { ini_set('apc.use_request_time', 0); } parent::__construct($namespace, $defaultLifetime); if (null !== $version) { CacheItem::validateKey($version); if (!apcu_exists($version.'@'.$namespace)) { $this->doClear($namespace); apcu_add($version.'@'.$namespace, null); } } $this->marshaller = $marshaller; } public static function isSupported() { return \function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN); } /** * {@inheritdoc} */ protected function doFetch(array $ids) { $unserializeCallbackHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback'); try { $values = []; $ids = array_flip($ids); foreach (apcu_fetch(array_keys($ids), $ok) ?: [] as $k => $v) { if (!isset($ids[$k])) { // work around https://github.com/krakjoe/apcu/issues/247 $k = key($ids); } unset($ids[$k]); if (null !== $v || $ok) { $values[$k] = null !== $this->marshaller ? $this->marshaller->unmarshall($v) : $v; } } return $values; } catch (\Error $e) { throw new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine()); } finally { ini_set('unserialize_callback_func', $unserializeCallbackHandler); } } /** * {@inheritdoc} */ protected function doHave(string $id) { return apcu_exists($id); } /** * {@inheritdoc} */ protected function doClear(string $namespace) { return isset($namespace[0]) && class_exists(\APCuIterator::class, false) && ('cli' !== \PHP_SAPI || filter_var(ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOLEAN)) ? apcu_delete(new \APCuIterator(sprintf('/^%s/', preg_quote($namespace, '/')), \APC_ITER_KEY)) : apcu_clear_cache(); } /** * {@inheritdoc} */ protected function doDelete(array $ids) { foreach ($ids as $id) { apcu_delete($id); } return true; } /** * {@inheritdoc} */ protected function doSave(array $values, int $lifetime) { if (null !== $this->marshaller && (!$values = $this->marshaller->marshall($values, $failed))) { return $failed; } try { if (false === $failures = apcu_store($values, null, $lifetime)) { $failures = $values; } return array_keys($failures); } catch (\Throwable $e) { if (1 === \count($values)) { // Workaround https://github.com/krakjoe/apcu/issues/170 apcu_delete(array_key_first($values)); } throw $e; } } }