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

Skip to content

[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

Merged
merged 1 commit into from
May 4, 2016

Conversation

nicolas-grekas
Copy link
Member

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 -

@xabbuh
Copy link
Member

xabbuh commented May 2, 2016

This needs some fix for RedisArray not being available on HHVM it seems (see facebook/hhvm#1992).

@nicolas-grekas nicolas-grekas force-pushed the redis-array branch 3 times, most recently from 69a7634 to 3aaa30d Compare May 2, 2016 15:38
@nicolas-grekas nicolas-grekas mentioned this pull request May 2, 2016
@nicolas-grekas nicolas-grekas force-pushed the redis-array branch 2 times, most recently from 8cde9cc to b8e0d65 Compare May 2, 2016 15:47
$connection = $this->redis->getConnection();
if ($connection instanceof PredisCluster) {
foreach ($connection as $c) {
$hosts[] = new \Predis\Client($c);
Copy link
Member

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 ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

} elseif ($redisClient instanceof \RedisArray) {
} elseif ($redisClient instanceof \RedisCluster) {
} elseif ($redisClient instanceof \Predis\Client) {
} else {
Copy link
Member

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) {
    // ...
}

Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if ($pipe) {
$this->redis->exec();
}
if (isset($e)) {
Copy link
Member

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.

@fabpot
Copy link
Member

fabpot commented May 4, 2016

Thank you @nicolas-grekas.

@fabpot fabpot merged commit b004243 into symfony:master May 4, 2016
fabpot added a commit that referenced this pull request May 4, 2016
…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
@nicolas-grekas nicolas-grekas deleted the redis-array branch May 4, 2016 19:15
@fabpot fabpot mentioned this pull request May 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants