Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
a1fd937 toddb8ecdComparedorrogeray commentedFeb 25, 2025
tillkruss commentedFeb 26, 2025
Nice work! Did you see#59846? |
alexandre-daubois commentedFeb 26, 2025
@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 supportUh oh!
There was an error while loading.Please reload this page.
\Relay\Cluster support\Relay\Cluster supportnicolas-grekas commentedFeb 26, 2025
Actually, can you do the same in the Lock and Semaphore components please? |
Uh oh!
There was an error while loading.Please reload this page.
ddb8ecd tob8bd231Comparedorrogeray commentedFeb 26, 2025
I will take a look 👍 |
47ed3e2 tob805823Comparedorrogeray commentedFeb 27, 2025
Errors in |
\Relay\Cluster support\Relay\Cluster supportUh oh!
There was an error while loading.Please reload this page.
b805823 tof4a76e0Comparefabpot commentedMar 3, 2025
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 | MITThis 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 authNote that `\Relay\Cluster` will only be used if `relay` extension is loaded```phpuse 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```phpuse 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:```phpuse 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 incachewerk/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 | MITFollows#59857 /cc `@dorrogeray` (some changes for the upcoming doc)Commits-------922f5ff [Cache] Code cleanup

Uh oh!
There was an error while loading.Please reload this page.
This PR allows usage of the
\Relay\Clusterclass inRedisAdapterwhenrelay extension is installed in version >= 0.10.0.Example usage
Creating a connection with auth
Note that
\Relay\Clusterwill only be used ifrelayextension is loadedCreating tls connection with self-signed certificate for testing in local environment
Alternatively if you already have an instance of
\Relay\Clusterwhich you want to use:With this PR, two connection options have been introduced:
Removed in favor of usingrelay_clusterwhich is a boolean indicating whether the user wants to create a\Relay\Clusterconnectionredis_clusterand the fact thatrelayextension is loaded to choose the\Relay\Clusterclasscommand_timeoutwhich is consumed by\Relay\Clusterand defaults to0relay_cluster_contextwhich is consumed by\Relay\Clusterand allows user to configure options described inIs there a way to set Relay::OPT_CLIENT_TRACKING flag in the Relay\Cluster constructor? cachewerk/relay#161 (comment)CC:@tillkruss