Skip to content

Commit 4e94fa3

Browse files
committed
minor #7072 Update performance.rst - "Caching the Autoloader with APC" section (cristi-contiu)
This PR was merged into the 2.8 branch. Discussion ---------- Update performance.rst - "Caching the Autoloader with APC" section The example provided under "Caching the Autoloader with APC" is not in sync with the content of the 'app.php' file in Symfony 2.8: - the comment hint was removed in symfony/symfony-standard#964 - the autoloader was extracted from bootstrap: symfony/symfony-standard@747a384 Even on PHP 5.6 with built-in OPcache, I still see a performance boost from enabling the ApcClassLoader. Commits ------- 4127ad9 Update performance.rst
2 parents 84415d8 + 4127ad9 commit 4e94fa3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

performance.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,21 @@ Caching the Autoloader with APC
7171
Another solution is to cache the location of each class after it's located
7272
the first time. Symfony comes with a class - :class:`Symfony\\Component\\ClassLoader\\ApcClassLoader` -
7373
that does exactly this. To use it, just adapt your front controller file.
74-
If you're using the Standard Distribution, this code should already be available
75-
as comments in this file::
74+
If you're using the Standard Distribution, make the following changes::
7675

7776
// app.php
7877
// ...
78+
79+
use Symfony\Component\ClassLoader\ApcClassLoader;
7980

80-
$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
81+
$loader = require __DIR__.'/../app/autoload.php';
82+
include_once __DIR__.'/../app/bootstrap.php.cache';
8183

8284
// Use APC for autoloading to improve performance
8385
// Change 'sf2' by the prefix you want in order
8486
// to prevent key conflict with another application
85-
/*
8687
$loader = new ApcClassLoader('sf2', $loader);
8788
$loader->register(true);
88-
*/
8989

9090
// ...
9191

0 commit comments

Comments
 (0)