/**
* @param CacheInterface|FileVarExportHandler|null $cache
*/
public function __construct($cache = null
) { $this->cache =
$cache ??
new FileVarExportHandler();
} public function save(string
$component): void
{ if (! Factories::
isUpdated($component)) { return;
} $data = Factories::
getComponentInstances($component);
$this->cache->
save($this->
getCacheKey($component),
$data, 3600 * 24
);
} private function getCacheKey(string
$component): string
{ return 'FactoriesCache_' .
$component;
}