cache = $cache; $this->readerList = $readerList; $this->serializer = $serializer; } /** * Get stores data * * @param string $runMode * @param string|null $scopeCode * @return array */ public function getStoresData(string $runMode, string $scopeCode = null) : array { $cacheKey = 'resolved_stores_' . md5($runMode . $scopeCode); $cacheData = $this->cache->load($cacheKey); if ($cacheData) { $storesData = $this->serializer->unserialize($cacheData); } else { $reader = $this->readerList->getReader($runMode); $storesData = [$reader->getAllowedStoreIds($scopeCode), $reader->getDefaultStoreId($scopeCode)]; $this->cache->save( $this->serializer->serialize($storesData), $cacheKey, [ self::CACHE_TAG, \Magento\Store\Model\Store::CACHE_TAG ] ); } return $storesData; } }