Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Conversation

dorrogeray
Copy link
Contributor

@dorrogeraydorrogeray commentedFeb 25, 2025
edited
Loading

QA
Branch?7.3
Bug fix?no
New feature?yes
Deprecations?no
Issuesn/a
LicenseMIT

This PR allows usage of the\Relay\Cluster class inRedisAdapter whenrelay 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 loaded

useSymfony\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 =newRedisAdapter($relayCluster);

Creating tls connection with self-signed certificate for testing in local environment

useSymfony\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:

useRelay\Cluster;useSymfony\Component\Cache\Adapter\RedisAdapter;$relayCluster =newCluster('my-relay-cluster-client',    ['valkey-cluster-untracked:6372','valkey-cluster-untracked:6373','valkey-cluster-untracked:6374',    ],);$cacheUsingRelayCluster =newRedisAdapter($relayCluster);

With this PR, two connection options have been introduced:

CC:@tillkruss

@dorrogeray
Copy link
ContributorAuthor

I am not sure what to make of this error:

image

Also not sure how to fix the psalm complaining about the the missing classes.

andrew-demb reacted with thumbs up emoji

@tillkruss
Copy link

Nice work!

Did you see#59846?

dorrogeray reacted with thumbs up emoji

@alexandre-daubois
Copy link
Member

@dorrogeray You can rebase your PR, the test failure you're facing is unrelated to your PR and has been fixed in#59861.

OskarStark reacted with thumbs up emoji

@OskarStarkOskarStark changed the title[Cache] Add \Relay\Cluster support to RedisAdapter[Cache][Redis] Add\Relay\Cluster supportFeb 26, 2025
@carsonbotcarsonbot changed the title[Cache][Redis] Add\Relay\Cluster support[Cache] [Redis] Add\Relay\Cluster supportFeb 26, 2025
@nicolas-grekas
Copy link
Member

Actually, can you do the same in the Lock and Semaphore components please?

@dorrogeraydorrogerayforce-pushed thecache-add-relay-cluster-support branch fromddb8ecd tob8bd231CompareFebruary 26, 2025 17:16
@dorrogeray
Copy link
ContributorAuthor

Actually, can you do the same in the Lock and Semaphore components please?

I will take a look 👍

@dorrogeraydorrogerayforce-pushed thecache-add-relay-cluster-support branch 6 times, most recently from47ed3e2 tob805823CompareFebruary 26, 2025 23:47
@dorrogeray
Copy link
ContributorAuthor

Errors inWindows / x86 / minimal-exts / lowest-php (pull_request) don't seem to be related to this PR, PHP 8.5 is crashing onzend_mm_heap corrupted and it looks like there is nothing I can do about the psalm not recognizing theRelay\Relay andRelay\Cluster classes..

@stof@jderusse I think its ready for review.

@alexandre-dauboisalexandre-daubois changed the title[Cache] [Redis] Add\Relay\Cluster support[Cache] Add\Relay\Cluster supportFeb 27, 2025
@fabpotfabpotforce-pushed thecache-add-relay-cluster-support branch fromb805823 tof4a76e0CompareMarch 3, 2025 07:55
@fabpot
Copy link
Member

Thank you@dorrogeray.

dorrogeray reacted with heart emoji

@fabpotfabpot closed thisMar 3, 2025
fabpot added a commit that referenced this pull requestMar 3, 2025
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
@nicolas-grekasnicolas-grekas mentioned this pull requestMar 5, 2025
nicolas-grekas added a commit that referenced this pull requestMar 13, 2025
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
@fabpotfabpot mentioned this pull requestMay 2, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@stofstofstof left review comments

@OskarStarkOskarStarkOskarStark left review comments

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@jderussejderusseAwaiting requested review from jderussejderusse is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
7.3
Development

Successfully merging this pull request may close these issues.

8 participants
@dorrogeray@tillkruss@alexandre-daubois@nicolas-grekas@fabpot@stof@OskarStark@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp