缓存工作/magento-relay

一个用于集成 Relay 的 Magento 2 模块。

安装: 85

依赖: 0

建议者: 0

安全: 0

星标: 4

关注者: 3

分支: 0

开放问题: 0

类型:magento2-module

0.1.1 2022-12-01 20:29 UTC

This package is auto-updated.

Last update: 2024-08-29 05:44:30 UTC


README

安装

首先,将 Relay 作为 PHP 扩展安装到您的 CLI 和 FPM 环境中,请参阅 安装 Relay

然后,安装 Magento 模块

composer require cachewerk/magento-relay

最后,激活模块。除非您配置 Magento 使用 Relay,否则它将不会使用。

bin/magento module:enable CacheWerk_Relay
bin/magento setup:upgrade

配置

如果您不使用 Magento 的 Redis 集成进行缓存和会话,我们建议您首先配置和测试该功能。

会话

要使用 Relay 作为会话后端,只需在您的 app/etc/env.php 中将 session.redis.client 设置为 relay

'session' => [
    'save' => 'redis',
    'redis' => [
+       'client' => 'relay',
        'host' => '127.0.0.1',
        'port' => 6379,
        'database' => 2,
        // ...
    ]
],

缓存后端

您可以在 app/etc/env.php 中使用 Relay 作为任何 Redis 启用的缓存后端。

'cache' => [
    'frontend' => [
        'default' => [
            'id_prefix' => '5ac_',
-           'backend' => 'Magento\\Framework\\Cache\\Backend\\Redis',
+           'backend' => 'CacheWerk\\Relay\\Cache\\Backend\\Relay',
            'backend_options' => [
                'server' => '127.0.0.1',
                'port' => 6379,
                'database' => 0,
                // ...
            ]
        ],
        'page_cache' => [
            'id_prefix' => '5ac_',
-           'backend' => 'Magento\\Framework\\Cache\\Backend\\Redis',
+           'backend' => 'CacheWerk\\Relay\\Cache\\Backend\\Relay',
            'backend_options' => [
                'server' => '127.0.0.1',
                'port' => 6379,
                'database' => 1,
                // ...
            ]
        ]
    ],
],