-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Cache] Add \Relay\Cluster
support
#59857
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
Conversation
a1fd937
to
ddb8ecd
Compare
Nice work! Did you see #59846? |
@dorrogeray You can rebase your PR, the test failure you're facing is unrelated to your PR and has been fixed in #59861. |
\Relay\Cluster
support
\Relay\Cluster
support\Relay\Cluster
support
Actually, can you do the same in the Lock and Semaphore components please? |
ddb8ecd
to
b8bd231
Compare
I will take a look 👍 |
47ed3e2
to
b805823
Compare
Errors in |
\Relay\Cluster
support\Relay\Cluster
support
b805823
to
f4a76e0
Compare
Thank you @dorrogeray. |
This PR was squashed before being merged into the 7.3 branch. Discussion ---------- [Cache] Add `\Relay\Cluster` support | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | n/a | License | MIT This PR allows usage of the `\Relay\Cluster` class in `RedisAdapter` when [relay](https://relay.so/) extension is installed in version >= 0.10.0. ## Example usage ### Creating a connection with auth Note that `\Relay\Cluster` will only be used if `relay` extension is loaded ```php use Symfony\Component\Cache\Adapter\RedisAdapter; $relayCluster = RedisAdapter::createConnection( 'redis:?host[valkey-cluster:6372]&host[valkey-cluster:6373]&host[valkey-cluster:6374]&auth=my-password&redis_cluster=1' ); $cacheUsingRelayCluster = new RedisAdapter($relayCluster); ``` ### Creating tls connection with self-signed certificate for testing in local environment ```php use Symfony\Component\Cache\Adapter\RedisAdapter; $relayCluster = RedisAdapter::createConnection( 'rediss:?host[valkey-cluster:6372]&host[valkey-cluster:6373]&host[valkey-cluster:6374]&redis_cluster=1&relay_cluster_context[stream][verify_peer]=false&relay_cluster_context[stream][verify_peer_name]=false&relay_cluster_context[stream][allow_self_signed]=true&relay_cluster_context[stream][local_cert]=/valkey.crt&relay_cluster_context[stream][local_pk]=/valkey.key&relay_cluster_context[stream][cafile]=/valkey.crt&relay_cluster_context[max-retries]=5&relay_cluster_context[client-tracking]=false' ); ``` ### Alternatively if you already have an instance of `\Relay\Cluster` which you want to use: ```php use Relay\Cluster; use Symfony\Component\Cache\Adapter\RedisAdapter; $relayCluster = new Cluster( 'my-relay-cluster-client', [ 'valkey-cluster-untracked:6372', 'valkey-cluster-untracked:6373', 'valkey-cluster-untracked:6374', ], ); $cacheUsingRelayCluster = new RedisAdapter($relayCluster); ``` With this PR, two connection options have been introduced: - ~~`relay_cluster` which is a boolean indicating whether the user wants to create a `\Relay\Cluster` connection~~ Removed in favor of using `redis_cluster` and the fact that `relay` extension is loaded to choose the `\Relay\Cluster` class - `command_timeout` which is consumed by `\Relay\Cluster` and defaults to `0` - `relay_cluster_context` which is consumed by `\Relay\Cluster` and allows user to configure options described in cachewerk/relay#161 (comment) CC: `@tillkruss` Commits ------- f4a76e0 [Cache] Add `\Relay\Cluster` support
This PR was merged into the 7.3 branch. Discussion ---------- [Cache] Code cleanup | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT Follows #59857 /cc `@dorrogeray` (some changes for the upcoming doc) Commits ------- 922f5ff [Cache] Code cleanup
This PR allows usage of the
\Relay\Cluster
class inRedisAdapter
when relay extension is installed in version >= 0.10.0.Example usage
Creating a connection with auth
Note that
\Relay\Cluster
will only be used ifrelay
extension is loadedCreating tls connection with self-signed certificate for testing in local environment
Alternatively if you already have an instance of
\Relay\Cluster
which you want to use:With this PR, two connection options have been introduced:
Removed in favor of usingrelay_cluster
which is a boolean indicating whether the user wants to create a\Relay\Cluster
connectionredis_cluster
and the fact thatrelay
extension is loaded to choose the\Relay\Cluster
classcommand_timeout
which is consumed by\Relay\Cluster
and defaults to0
relay_cluster_context
which is consumed by\Relay\Cluster
and allows user to configure options described in Is there a way to set Relay::OPT_CLIENT_TRACKING flag in the Relay\Cluster constructor? cachewerk/relay#161 (comment)CC: @tillkruss