Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Cache] Add Redis Relay doc #17870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions components/cache/adapters/redis_adapter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ to utilize a cluster of servers to provide redundancy and/or fail-over is also a

**Requirements:** At least one `Redis server`_ must be installed and running to use this
adapter. Additionally, this adapter requires a compatible extension or library that implements
``\Redis``, ``\RedisArray``, ``RedisCluster``, or ``\Predis``.
``\Redis``, ``\RedisArray``, ``RedisCluster``, ``\Relay\Relay`` or ``\Predis``.

This adapter expects a `Redis`_, `RedisArray`_, `RedisCluster`_, or `Predis`_ instance to be
This adapter expects a `Redis`_, `RedisArray`_, `RedisCluster`_, `Relay`_ or `Predis`_ instance to be
passed as the first parameter. A namespace and default cache lifetime can optionally be passed
as the second and third parameters::

Expand All @@ -47,6 +47,10 @@ as the second and third parameters::
$defaultLifetime = 0
);

.. versionadded:: 6.3

Support for `Relay`_ was introduced in Symfony 6.3.

Configure the Connection
------------------------

Expand Down Expand Up @@ -165,10 +169,14 @@ array of ``key => value`` pairs representing option names and their respective v
Available Options
~~~~~~~~~~~~~~~~~

.. versionadded:: 6.3

``\Relay\Relay`` support was introduced in Symfony 6.3.

``class`` (type: ``string``, default: ``null``)
Specifies the connection library to return, either ``\Redis`` or ``\Predis\Client``.
If none is specified, it will return ``\Redis`` if the ``redis`` extension is
available, and ``\Predis\Client`` otherwise. Explicitly set this to ``\Predis\Client`` for Sentinel if you are
Specifies the connection library to return, either ``\Redis``, ``\Relay\Relay`` or ``\Predis\Client``.
If none is specified, fallback value is in following order, depending which one is available first:
``\Redis``, ``\Relay\Relay``, ``\Predis\Client``. Explicitly set this to ``\Predis\Client`` for Sentinel if you are
running into issues when retrieving master information.

``persistent`` (type: ``int``, default: ``0``)
Expand Down Expand Up @@ -258,6 +266,7 @@ Read more about this topic in the official `Redis LRU Cache Documentation`_.
.. _`Redis`: https://github.com/phpredis/phpredis
.. _`RedisArray`: https://github.com/phpredis/phpredis/blob/master/arrays.markdown#readme
.. _`RedisCluster`: https://github.com/phpredis/phpredis/blob/master/cluster.markdown#readme
.. _`Relay`: https://relay.so/
.. _`Predis`: https://packagist.org/packages/predis/predis
.. _`Predis Connection Parameters`: https://github.com/nrk/predis/wiki/Connection-Parameters#list-of-connection-parameters
.. _`TCP-keepalive`: https://redis.io/topics/clients#tcp-keepalive
Expand Down
6 changes: 5 additions & 1 deletion components/lock.rst
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,12 @@ store locks and does not expire.
RedisStore
~~~~~~~~~~

.. versionadded:: 6.3

``\Relay\Relay`` support was introduced in Symfony 6.3.

The RedisStore saves locks on a Redis server, it requires a Redis connection
implementing the ``\Redis``, ``\RedisArray``, ``\RedisCluster`` or
implementing the ``\Redis``, ``\RedisArray``, ``\RedisCluster``, ``\Relay\Relay`` or
``\Predis`` classes. This store does not support blocking, and expects a TTL to
avoid stalled locks::

Expand Down
6 changes: 3 additions & 3 deletions session.rst
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ a Symfony service for the connection to the Redis server:
# - { 'prefix': 'my_prefix', 'ttl': 600 }

Redis:
# you can also use \RedisArray, \RedisCluster or \Predis\Client classes
# you can also use \RedisArray, \RedisCluster, \Relay\Relay or \Predis\Client classes
class: Redis
calls:
- connect:
Expand All @@ -526,7 +526,7 @@ a Symfony service for the connection to the Redis server:
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<!-- you can also use \RedisArray, \RedisCluster or \Predis\Client classes -->
<!-- you can also use \RedisArray, \RedisCluster, \Relay\Relay or \Predis\Client classes -->
<service id="Redis" class="Redis">
<call method="connect">
<argument>%env(REDIS_HOST)%</argument>
Expand Down Expand Up @@ -565,7 +565,7 @@ a Symfony service for the connection to the Redis server:
use Symfony\Component\HttpFoundation\Session\Storage\Handler\RedisSessionHandler;

$container
// you can also use \RedisArray, \RedisCluster or \Predis\Client classes
// you can also use \RedisArray, \RedisCluster, \Relay\Relay or \Predis\Client classes
->register('Redis', \Redis::class)
->addMethodCall('connect', ['%env(REDIS_HOST)%', '%env(int:REDIS_PORT)%'])
// uncomment the following if your Redis server requires a password:
Expand Down