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 30bc8ed

Browse filesBrowse files
committed
minor #7258 [ClassLoader] deprecate caching class loaders (xabbuh)
This PR was merged into the master branch. Discussion ---------- [ClassLoader] deprecate caching class loaders Updates the documentation for symfony/symfony#20777. Commits ------- 2e6cfca [ClassLoader] deprecate caching class loaders
2 parents 9439e41 + 2e6cfca commit 30bc8ed
Copy full SHA for 30bc8ed

File tree

2 files changed

+13
-56
lines changed
Filter options

2 files changed

+13
-56
lines changed

‎components/class_loader.rst

Copy file name to clipboardExpand all lines: components/class_loader.rst
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,15 @@ Learn More
5252
:maxdepth: 1
5353

5454
class_loader/class_loader
55-
class_loader/*
55+
class_loader/class_map_generator.rst
56+
class_loader/debug_class_loader.rst
57+
class_loader/map_class_loader.rst
58+
class_loader/psr4_class_loader.rst
59+
60+
.. toctree::
61+
:hidden:
62+
63+
class_loader/cache_class_loader
5664

5765
.. _PSR-0: http://www.php-fig.org/psr/psr-0/
5866
.. _PSR-4: http://www.php-fig.org/psr/psr-4/

‎components/class_loader/cache_class_loader.rst

Copy file name to clipboardExpand all lines: components/class_loader/cache_class_loader.rst
+4-55Lines changed: 4 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -8,58 +8,7 @@
88
Cache a Class Loader
99
====================
1010

11-
Finding the file for a particular class can be an expensive task. Luckily,
12-
the ClassLoader component comes with two classes to cache the mapping
13-
from a class to its containing file. Both the :class:`Symfony\\Component\\ClassLoader\\ApcClassLoader`
14-
and the :class:`Symfony\\Component\\ClassLoader\\XcacheClassLoader` wrap
15-
around an object which implements a ``findFile()`` method to find the file
16-
for a class.
17-
18-
.. note::
19-
20-
Both the ``ApcClassLoader`` and the ``XcacheClassLoader`` can be used
21-
to cache Composer's `autoloader`_.
22-
23-
ApcClassLoader
24-
--------------
25-
26-
``ApcClassLoader`` wraps an existing class loader and caches calls to its
27-
``findFile()`` method using `APC`_::
28-
29-
require_once '/path/to/src/Symfony/Component/ClassLoader/ApcClassLoader.php';
30-
31-
// instance of a class that implements a findFile() method, like the ClassLoader
32-
$loader = ...;
33-
34-
// sha1(__FILE__) generates an APC namespace prefix
35-
$cachedLoader = new ApcClassLoader(sha1(__FILE__), $loader);
36-
37-
// register the cached class loader
38-
$cachedLoader->register();
39-
40-
// deactivate the original, non-cached loader if it was registered previously
41-
$loader->unregister();
42-
43-
XcacheClassLoader
44-
-----------------
45-
46-
``XcacheClassLoader`` uses `XCache`_ to cache a class loader. Registering
47-
it is straightforward::
48-
49-
require_once '/path/to/src/Symfony/Component/ClassLoader/XcacheClassLoader.php';
50-
51-
// instance of a class that implements a findFile() method, like the ClassLoader
52-
$loader = ...;
53-
54-
// sha1(__FILE__) generates an XCache namespace prefix
55-
$cachedLoader = new XcacheClassLoader(sha1(__FILE__), $loader);
56-
57-
// register the cached class loader
58-
$cachedLoader->register();
59-
60-
// deactivate the original, non-cached loader if it was registered previously
61-
$loader->unregister();
62-
63-
.. _APC: http://php.net/manual/en/book.apc.php
64-
.. _autoloader: https://getcomposer.org/doc/01-basic-usage.md#autoloading
65-
.. _XCache: http://xcache.lighttpd.net
11+
The ``ApcClassLoader``, the ``WinCacheClassLoader`` and the ``XcacheClassLoader``
12+
are deprecated since Symfony 3.3. Use the ``--optimize`` and ``--apcu-autoloader``
13+
options instead when dumping the autoloader using the ``composer dump-autoload``
14+
command.

0 commit comments

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