-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[Cache] Add support for Predis, RedisArray and RedisCluster #18689
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
nicolas-grekas
commented
May 2, 2016
| Q | A |
|---|---|
| Branch? | 3.1 ideally |
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | - |
| License | MIT |
| Doc PR | - |
0727e81 to
f58751d
Compare
|
This needs some fix for |
69a7634 to
3aaa30d
Compare
8cde9cc to
b8e0d65
Compare
| $connection = $this->redis->getConnection(); | ||
| if ($connection instanceof PredisCluster) { | ||
| foreach ($connection as $c) { | ||
| $hosts[] = new \Predis\Client($c); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will also keep the PredisCluster itself in the array of hosts. Is it expected ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0343749 to
5ca5666
Compare
| } elseif ($redisClient instanceof \RedisArray) { | ||
| } elseif ($redisClient instanceof \RedisCluster) { | ||
| } elseif ($redisClient instanceof \Predis\Client) { | ||
| } else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really weird. I would prefer something like this:
if (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \RedisCluster && !$redisClient instanceof \Predis\Client) {
// ...
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, I agree with @xabbuh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5ca5666 to
f2ee0c8
Compare
| if ($pipe) { | ||
| $this->redis->exec(); | ||
| } | ||
| if (isset($e)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using isset, you should declare the $e variable and check if it's not null here.
f2ee0c8 to
b004243
Compare
|
Thank you @nicolas-grekas. |
…uster (nicolas-grekas) This PR was merged into the 3.1-dev branch. Discussion ---------- [Cache] Add support for Predis, RedisArray and RedisCluster | Q | A | ------------- | --- | Branch? | 3.1 ideally | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- b004243 [Cache] Add support for Predis, RedisArray and RedisCluster