class CachedClassMapGenerator in X Autoload 7.5
Same name and namespace in other branches
- 7.4 lib/Discovery/CachedClassMapGenerator.php \Drupal\xautoload\Discovery\CachedClassMapGenerator
Hierarchy
- class \Drupal\xautoload\Discovery\CachedClassMapGenerator implements ClassMapGeneratorInterface
Expanded class hierarchy of CachedClassMapGenerator
1 file declares its use of CachedClassMapGenerator
- ServiceFactory.php in src/
DIC/ ServiceFactory.php
File
- src/
Discovery/ CachedClassMapGenerator.php, line 6
Namespace
Drupal\xautoload\DiscoveryView source
class CachedClassMapGenerator implements ClassMapGeneratorInterface {
/**
* @var ClassMapGeneratorInterface
*/
protected $decorated;
/**
* @var \Drupal\xautoload\DrupalSystem\DrupalSystemInterface
*/
protected $system;
/**
* @param ClassMapGeneratorInterface $decorated
* @param \Drupal\xautoload\DrupalSystem\DrupalSystemInterface $system
*/
function __construct($decorated, $system) {
$this->decorated = $decorated;
$this->system = $system;
}
/**
* @param string[] $paths
*
* @return string[]
*/
function wildcardPathsToClassmap($paths) {
// Attempt to load from cache.
$cid = 'xautoload:wildcardPathsToClassmap:' . md5(serialize($paths));
$cache = $this->system
->cacheGet($cid);
if ($cache && isset($cache->data)) {
return $cache->data;
}
// Resolve cache miss and save.
$map = $this->decorated
->wildcardPathsToClassmap($paths);
$this->system
->cacheSet($cid, $map);
return $map;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CachedClassMapGenerator:: |
protected | property | ||
CachedClassMapGenerator:: |
protected | property | ||
CachedClassMapGenerator:: |
function |
Overrides ClassMapGeneratorInterface:: |
||
CachedClassMapGenerator:: |
function |