4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Cache\Simple;
14 use Symfony\Component\Cache\Exception\CacheException;
15 use Symfony\Component\Cache\PruneableInterface;
16 use Symfony\Component\Cache\Traits\PhpFilesTrait;
18 class PhpFilesCache extends AbstractCache implements PruneableInterface
23 * @param string $namespace
24 * @param int $defaultLifetime
25 * @param string|null $directory
27 * @throws CacheException if OPcache is not enabled
29 public function __construct($namespace = '', $defaultLifetime = 0, $directory = null)
31 if (!static::isSupported()) {
32 throw new CacheException('OPcache is not enabled.');
34 parent::__construct('', $defaultLifetime);
35 $this->init($namespace, $directory);
37 $e = new \Exception();
38 $this->includeHandler = function () use ($e) { throw $e; };
39 $this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), \FILTER_VALIDATE_BOOLEAN);