承接 valantic-spryker/sitemap-storage 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

  1. composer require valantic-spryker/sitemap-storage
  2. Since this module is under ValanticSpryker namespace, make sure that in config_default:
    1. $config[KernelConstants::CORE_NAMESPACES] has the namespace
    2. $config[KernelConstants::PROJECT_NAMESPACES] has the namespace
  3. Run console propel:install to install the val_sitemap_storage table.

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

GitHub 信息

  • Stars: 0
  • Watchers: 7
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2024-12-03