Symfony\Component\ClassLoader\WinCacheClassLoader
WinCacheClassLoader implements a wrapping autoloader cached in WinCache.
It expects an object implementing a findFile method to find the file. This
allow using it as a wrapper around the other loaders of the component (the
ClassLoader and the UniversalClassLoader for instance) but also around any
other autoloader following this convention (the Composer one for instance)
$loader = new ClassLoader();
// register classes with namespaces
$loader->add('Symfony\Component', __DIR__.'/component');
$loader->add('Symfony', __DIR__.'/framework');
$cachedLoader = new WinCacheClassLoader('my_prefix', $loader);
// activate the cached autoloader
$cachedLoader->register();
// eventually deactivate the non-cached loader if it was registered previously
// to be sure to use the cached one.
$loader->unregister();
- Author: Fabien Potencier <fabien@symfony.com>
Synopsis
class WinCacheClassLoader
{
- // members
- private $prefix;
- protected ClassLoader $decorated;
- // methods
- public void __construct()
- public void register()
- public void unregister()
- public Boolean|null loadClass()
- public string|null findFile()
- public void __call()
Members
private
- $prefix
protected
- $decorated
—
\Symfony\Component\ClassLoader\ClassLoader
The class loader object being decorated.
Methods
public
- __construct() — Constructor.
- __call() — Passes through all unknown calls onto the decorated object.
- findFile() — Finds a file by class name while caching lookups to WinCache.
- loadClass() — Loads the given class or interface.
- register() — Registers this instance as an autoloader.
- unregister() — Unregisters this instance as an autoloader.