You are here

class CacheMissLoaderSetFinder in X Autoload 7.5

Replaces the ProxyClassFinder in the ClassLoader with the real ClassLoader.

xautoload has a number of cached class loaders, working with APC cache or other key-value stores.

The cached class loaders use the decorator pattern, and decorate a ClassFinder object, that will only be consulted on a cache miss.

xautoload will first give the ClassLoader a ProxyClassFinder that wraps the real class loader. On the first cache miss, this ProxyClassFinder will notify all subscribed CacheMissObserverInterface object.

The job of this particular observer is to replace the ProxyClassFinder, once it has done its job. Instead, the ClassLoader will get a reference ot the real ClassLoader, saving the overhead of going through ProxyClassFinder each time.

Hierarchy

Expanded class hierarchy of CacheMissLoaderSetFinder

See also

ProxyClassFinder

1 file declares its use of CacheMissLoaderSetFinder
xautoload.module in ./xautoload.module

File

src/CacheMissObserver/CacheMissLoaderSetFinder.php, line 27

Namespace

Drupal\xautoload\CacheMissObserver
View source
class CacheMissLoaderSetFinder implements CacheMissObserverInterface {

  /**
   * @var AbstractClassLoaderDecorator
   */
  protected $loader;

  /**
   * @param AbstractClassLoaderDecorator $loader
   */
  function __construct($loader) {
    $this->loader = $loader;
  }

  /**
   * {@inheritdoc}
   */
  function cacheMiss($finder) {
    $this->loader
      ->setFinder($finder);
  }

}

Members