cachewerk/magento-relay

A Magento 2 module to integrate Relay.

0.1.1 2022-12-01 20:29 UTC

This package is auto-updated.

Last update: 2024-03-29 04:39:13 UTC


README

Installation

First, install Relay as a PHP extension for your CLI and FPM environments.

Next, install the Magento module:

composer require cachewerk/magento-relay

Finally, activate the module. Relay won't be used until you configure Magento to do so.

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

Configuration

If you're not using Magento's Redis integration for caching and sessions, we recommend configuring and testing that first.

Sessions

To use Relay as the session backend, simply set session.redis.client to relay in your app/etc/env.php:

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

Cache Backends

Relay can be used for any Redis-enabled cache backend in your app/etc/env.php:

'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,
                // ...
            ]
        ]
    ],
],