valantic-spryker / sitemap-storage
Add functionality to retrieve sitemap data from storage (Redis).
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 7
Forks: 0
Open Issues: 0
pkg:composer/valantic-spryker/sitemap-storage
Requires
- php: >=7.4
- valantic-spryker/sitemap: ^4.0.4
Requires (Dev)
This package is auto-updated.
Last update: 2025-10-01 00:16:56 UTC
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, ]; }