valantic-spryker/sitemap-storage
Composer 安装命令:
composer require valantic-spryker/sitemap-storage
包简介
Add functionality to retrieve sitemap data from storage (Redis).
关键字:
README 文档
README
Description
Adds functionality to publish and retrieve sitemap data from storage (Redis). The data is stored in DB and synced to Redis for faster retrieval.
⚠️ This package does not support Spryker setups that have different Redis instances for different stores
Installation
composer require valantic-spryker/sitemap-storage- Since this module is under
ValanticSprykernamespace, make sure that inconfig_default:$config[KernelConstants::CORE_NAMESPACES]has the namespace$config[KernelConstants::PROJECT_NAMESPACES]has the namespace
- Run
console propel:installto install theval_sitemap_storagetable.
4. Add relevant queues to QueueDependencyProvider:
protected function getProcessorMessagePlugins(Container $container): array { return [ // ... SitemapStorageConfig::PUBLISH_SITEMAP => new EventQueueMessageProcessorPlugin(), SitemapStorageConfig::SITEMAP_SYNC_STORAGE_QUEUE => new SynchronizationStorageQueueMessageProcessorPlugin(), ]; }
5. Register SitemapStorageEventSubscriber
Add
ValanticSpryker\Zed\SitemapStorage\Communication\Plugin\Event\Subscriber\SitemapStorageEventSubscriber
in
\Pyz\Zed\Event\EventDependencyProvider::getEventSubscriberCollection
to handle all publish and unpublish events:
public function getEventSubscriberCollection(): EventSubscriberCollectionInterface { $eventSubscriberCollection = parent::getEventSubscriberCollection(); // ... $eventSubscriberCollection->add(new SitemapStorageEventSubscriber()); }
6. Enable SitemapStorageClient
Since SitemapStorageClient implements the same interface as SitemapClient, both clients can be used interchangeably.
So to make the main Sitemap module retrieve data from Redis, the SitemapStorageClient needs to be switched with regular SitemapClient in:
\ValanticSpryker\Yves\Sitemap\SitemapDependencyProvider
protected function addSitemapClient(Container $container): void { $container->set(static::CLIENT_SITEMAP, static function (Container $container): SitemapClientInterface { return $container->getLocator()->sitemapStorage()->client(); }); }
Now the SitemapStorageClient is used instead, and it takes care of retrieving the data from Redis and mapping to correct transfer.
7. Add queue configuration to \Pyz\Client\RabbitMq\RabbitMqConfig
protected function getPyzPublishQueueConfiguration(): array { return [ // [...] SitemapStorageConfig::PUBLISH_SITEMAP, ]; } protected function getPyzSynchronizationQueueConfiguration(): array { return [ // [...] SitemapStorageConfig::SITEMAP_SYNC_STORAGE_QUEUE, ]; }
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2024-12-03