Skip to content

Commit e9db324

Browse files
author
Volodymyr Kublytskyi
committed
MAGETWO-54054: Compiler performance optimization
- MAGETWO-50778: [Github][PR] Add cache of configuration files list #1628 - Merge commit 'refs/pull/1628/head' of github.com:magento/magento2 into MAGETWO-50778 # Conflicts: # lib/internal/Magento/Framework/Module/Dir/Reader.php
2 parents d95d459 + be22b37 commit e9db324

File tree

1 file changed

+11
-1
lines changed
  • lib/internal/Magento/Framework/Module/Dir

1 file changed

+11
-1
lines changed

lib/internal/Magento/Framework/Module/Dir/Reader.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ class Reader
4646
*/
4747
protected $readFactory;
4848

49+
/**
50+
* Cache storage
51+
*
52+
* @var array
53+
*/
54+
protected $cache = [];
55+
4956
/**
5057
* @param Dir $moduleDirs
5158
* @param ModuleListInterface $moduleList
@@ -72,7 +79,10 @@ public function __construct(
7279
*/
7380
public function getConfigurationFiles($filename)
7481
{
75-
return $this->fileIteratorFactory->create($this->getFiles($filename, Dir::MODULE_ETC_DIR));
82+
if (isset($this->cache[$filename])) {
83+
return $this->cache[$filename];
84+
}
85+
return $this->cache[$filename] = $this->fileIteratorFactory->create($this->getFiles($filename, Dir::MODULE_ETC_DIR));
7686
}
7787

7888
/**

0 commit comments

Comments
 (0)