[Cache] Improve performances into foreach (PhpFilesAdapter)
This commit is contained in:
parent
c41cfcb897
commit
7e4573bcfb
@ -92,6 +92,7 @@ class PhpFilesAdapter extends AbstractAdapter
|
||||
{
|
||||
$ok = true;
|
||||
$data = array($lifetime ? time() + $lifetime : PHP_INT_MAX, '');
|
||||
$allowCompile = 'cli' !== PHP_SAPI || ini_get('opcache.enable_cli');
|
||||
|
||||
foreach ($values as $key => $value) {
|
||||
if (null === $value || is_object($value)) {
|
||||
@ -116,7 +117,7 @@ class PhpFilesAdapter extends AbstractAdapter
|
||||
$file = $this->getFile($key, true);
|
||||
$ok = $this->write($file, '<?php return '.var_export($data, true).';') && $ok;
|
||||
|
||||
if ('cli' !== PHP_SAPI || ini_get('opcache.enable_cli')) {
|
||||
if ($allowCompile) {
|
||||
@opcache_compile_file($file);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user