Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7e4573b

Browse filesBrowse files
hadjedjvincentnicolas-grekas
authored andcommitted
[Cache] Improve performances into foreach (PhpFilesAdapter)
1 parent c41cfcb commit 7e4573b
Copy full SHA for 7e4573b

File tree

Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed

‎src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ protected function doSave(array $values, $lifetime)
9292
{
9393
$ok = true;
9494
$data = array($lifetime ? time() + $lifetime : PHP_INT_MAX, '');
95+
$allowCompile = 'cli' !== PHP_SAPI || ini_get('opcache.enable_cli');
9596

9697
foreach ($values as $key => $value) {
9798
if (null === $value || is_object($value)) {
@@ -116,7 +117,7 @@ protected function doSave(array $values, $lifetime)
116117
$file = $this->getFile($key, true);
117118
$ok = $this->write($file, '<?php return '.var_export($data, true).';') && $ok;
118119

119-
if ('cli' !== PHP_SAPI || ini_get('opcache.enable_cli')) {
120+
if ($allowCompile) {
120121
@opcache_compile_file($file);
121122
}
122123
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.