function XCacheClassLoader::loadClass in X Autoload 7.4
Same name and namespace in other branches
- 7.5 src/ClassLoader/XCacheClassLoader.php \Drupal\xautoload\ClassLoader\XCacheClassLoader::loadClass()
Callback for class loading. This will include ("require") the file found.
Parameters
string $class: The class to load.
Overrides AbstractClassLoaderDecorator::loadClass
File
- lib/
ClassLoader/ XCacheClassLoader.php, line 21
Class
Namespace
Drupal\xautoload\ClassLoaderCode
function loadClass($class) {
// Look if the cache has anything for this class.
if (xcache_isset($this->prefix . $class) && ($file = xcache_get($this->prefix . $class))) {
if (is_file($file)) {
require $file;
return;
}
xcache_unset($this->prefix . $class);
}
// Resolve cache miss.
$api = new LoadClassGetFileInjectedApi($class);
if ($this->finder
->apiFindFile($api, $class)) {
xcache_set($this->prefix . $class, $api
->getFile());
}
}